-
Notifications
You must be signed in to change notification settings - Fork 42
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
Wrong order of evaluation in application of curried function #50
Comments
Followup: I found this workaround:
which behaves in a way that is consistent with the standard. So the bug is no longer show-stopping; it's just a bug. |
On 26Jul17, 18:38, "Norman Ramsey" <[email protected]<mailto:[email protected]>> wrote:
Followup: I found this workaround:
val _ = let val g = shout_then_apply id in g end (print "Take two.\n")
which behaves in a way that is consistent with the standard. So the bug is no longer show-stopping; it's just a bug.
Indeed it's a deviation from the Standard, and the root cause of this is that mosml uses the Caml abstract machine which is most efficient when evaluating application from right to left (as you noted when raising the issue). So in fact the bug has been there since version 1.0. We (then Sergei Romanenko and I) could not find a robust solution that also had good performance (somewhat more of a concern on a 16 MHz 80386 than it is today). So we decided to leave it there, and hope that only few people would be sophisticated enough to exploit both side effects and higher-order functions in the same code. I'm pretty sure that Andreas Rossberg noted this too, but apart from that there is at most one or two others who have pointed this out in the past 23 years.
Peter
|
I'm sure it's rarely encountered, but in the next release of the manual you might want to point it out, rather than encourage people to report "any deviation" as a bug. And other people might like to know about the workaround... (My real application is slightly sordid, which is to instrument the evaluation of a
If the application happens to raise an exception, it is caught elsewhere, and the counter is reset. P.S. @rossberg is pretty good company! |
On 27Jul17, 21:50, "Norman Ramsey" <[email protected]<mailto:[email protected]>> wrote:
I'm sure it's rarely encountered, but in the next release of the manual you might want to point it out, rather than encourage people to report "any deviation" as a bug. And other people might like to know about the workaround...
Indeed, it is stupid that we didn't include a section "Known deviations from Standard ML" or similar...
Peter
|
This bug has been noted in mosml/doc/bugs as long as I can remember!
|
On 21Dec17, 4:36, "Doug Currie" <[email protected]<mailto:[email protected]>> wrote:
This bug has been noted in mosml/doc/bugs as long as I can remember!
· e
Indeed -- and is unlikely to ever be fixed.
Have a merry christmas,
Peter
|
Moscow ML seems to be applying functions the Caml way, rather than what is called for in the Definition of Standard ML. The manual says to report this deviation as a bug. For me, it's a show-stopping bug.
Example source code:
The standard says that the first
print
should be called whenshout_then_apply
is applied toid
, which is before the secondprint
is evaluated. But that's not what mosml does:For comparison, here's output from MLton:
Standard ML of New Jersey also gets the evaluation order right.
For me, this is a show-stopping bug---is there any chance of getting it fixed?
The text was updated successfully, but these errors were encountered: