Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: Support inequalities in pattern variables #28

Closed
jsccast opened this issue Feb 8, 2018 · 3 comments
Closed

New feature: Support inequalities in pattern variables #28

jsccast opened this issue Feb 8, 2018 · 3 comments

Comments

@jsccast
Copy link
Member

jsccast commented Feb 8, 2018

Today a guard can check an inequality. For example, the message {"temp":10} matched against {"temp":"?t"} results in a binding {"?t":10}, which a guard can contemplate based on (say) t<12.

The suggested new feature has two forms.

  1. Support pattern variables of the form "?<X" and "?>X". When given a binding for ?X, one of those patterns matches if the respective inequality is true.

  2. Support pattern variables of the form "?<CONSTANT" and "?>CONSTANT", where CONSTANT is a constant literal (a number or string). A match would not extend the pattern matching bindings.

In both cases, also support <=, >=, and ! (which means "not equal").

Since the above behavior can be accomplished with guards, this new behavior isn't necessary. However, possible gains in efficiency and conciseness seem to justify these special cases. (As an example, this feature would make dealing with out-of-order messages much easier.)

@jsccast
Copy link
Member Author

jsccast commented Feb 12, 2018

A slippery slope?

@boriwo
Copy link

boriwo commented Feb 13, 2018

Feels a bit slippery.

@jsccast
Copy link
Member Author

jsccast commented Mar 23, 2018

See comments at 3ed8fac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants