Closed dfmorrison closed 8 years ago
This should be fixed, thanks.
fix commited, being CI tested.
CI test passed, merging.
@guicho271828 The documentation should be updated to reflect this change. Currently the docstring and wiki says it matches any list.
On Fri, Jul 29, 2016 at 2:38 AM, Javier Olaechea notifications@github.com wrote:
@dfmorrison This works as documented, in the docstring and wiki, in trivia. So this is a suggestion for a behavior change for compatibility with optima?
My apologies, I was seduced by Trivia describing itself as a drop-in replacement for Optima, and it never occurred to me that the assoc pattern might deliberately be different between the two.
While I've not tried the latest, I gather Trivia has now be changed to have Optima's semantics for assoc. If so, thank you, I do think this is preferable, on several grounds, in addition to compatibility:
Don Morrison dfm@ringing.org "All good theoretical physicists put this number [the fine structure constant] up on their wall and worry about it." -- Richard Feynman, QED: The Strange Theory of Light and Matter
@dfmorrison , this is clearly a bug, so I fixed it. Also, if my description gives you the misleading impression about the compatibility, I'm sorry. Apart from this, however, let me clarify the following:
otherwise
) does not have to be implemented in trivia, even though it is in Optima's README. Reason: Since it is not tested, there is no guarantee that the feature still work in the current or the future version of Optima.otherwise
clauses are not tested in Optima, therefore its implementation priority was low until you had pointed it out.assoc
pattern's erroneous cases were not tested in optima either (because I carried the same test code from optima about assoc
pattern), which is analogous to "undefined behavior" in ANSI C or ANSI CL which allows the compiler to behave arbitrarily. However, still, I could not surpass the odd behavior in this issue, so I was urged to add new test cases and made it more reliable.It is always good to have suggestions. Also, in general, newly added test cases can be backported to Optima. Thank you.
Well, rethinking --- I did made some changes to assoc
pattern test cases. hmm...
Anyways, I am trying to be as consistent as possible. Also, check for incompatibility
in suite.lisp. semantic changes are in assoc and property patterns only (which is about if the key is evaluated or not -- not related to this issue). fail
is just moved to the other package and 1-pass compilation issue is transparent to the user.
The
assoc
pattern appears to mistakenly match anything at all. It only binds the variable when it should match, but still pretends it did match even when it shouldn't have with the variable bound tonil
.Compare this to the behavior of Optima, which seems to get it right: