This was an interesting one! I've committed a fix for it. My regression test is
fun test 0 _ = () | test _ _ = raise Fail "wrong";
val () = let val xz = 1 in test 0xz end; val () = let val wxz = 1 in test 0wxz end; val () = let val xw9 = 1 in test 0xw9 end; val () = let val x = 1 in test 0x; () end;
which I think covers the various cases.
Looking back, I found there was actually a fix for a very similar bug with real numbers where val e = (1, 2); #1e; was failing because it was trying to parse this as a real constant.
The rules for when spaces are needed are a bit inconsistent. I often get caught out with the equals sign. {x=nil} but not {x=#"a"}
Thanks for reporting it. David
On 23/02/2015 12:37, Rob Arthan wrote:
I mistyped a word constant and was a bit surprised by the error message.
rda]- poly Poly/ML 5.5.2 Release
0xw9;
Error-malformed integer constant: 0w Static Errors
Contrast this with SML/NJ:
rda]- sml Standard ML of New Jersey v110.76 [built: Mon Mar 3 16:26:20 2014]
- 0xw9;
stdIn:3.2-3.5 Error: unbound variable or constructor: xw9 stdIn:3.1-3.5 Error: operator is not a function [literal] operator: int in expression: 0 <errorvar>
With the following contrived example:
fun f x y = print "Boo!" val xw9 = "xw9"; f 0xw9;
Poly/ML reports a syntax error while SML/NJ and mlton both print Boo!
I am not sure who is right about this.
Regards,
Rob.
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml