-
Notifications
You must be signed in to change notification settings - Fork 146
Fix bugs due to empty set in wildcard restriction and + signs #601
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
Conversation
|
In principle, the set for the pattern matching can be changed at compile-time, for example, I think it should work even if |
|
Do you mean that you would like all of the args of Otherwise, this example currently "works as intended" for |
Yes, I think this is the natural interpretation of this pattern, |
|
OK. It is not quite as simple as I thought (just Generally it is not clear in what circumstances various "old" values need to be put back or not. |
The set elements may come with an arbitrary number of + or - signs, set the sign flag properly (rather, do not set the sign flag) in the case of + signs. Closes form-dev#599
|
Rebased, and implements the match for |
tueda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
This PR fixes #554 and #599 .
The behaviour that I noted at the end of #554 (comment) is intended. When creating the {} sets, it finds that they exist already and doesn't create a copy:
https://github.com/vermaseren/form/blob/8abec49f876deae1d13ad159519b301f0b140dc5/sources/names.c#L2471-L2474
Thus the following defines only xs and xs2:
There is one point for discussion: the second commit implies that
id f(x?!{}) = x;also does not match. In principle one could claim that x is indeed not a member of the empty set, so that this should match, but to my knowledge there will never be a case wherex?does match an empty set (x?can not be "nothing" in FORM currently) so it feels a bit odd to match in this case to me.One could even claim that
x?{}could be a syntax error and terminate. In that case thex?!{}question is irrelevant.Any thoughts?