{{{ An integer constant (in decimal notation) is an optional negation symbol (~) followed by a non-empty sequence of decimal digits 0,.., 9. An integer constant (in hexadecimal notation) is an optional negation symbol followed by 0x followed by a non-empty sequence of hexadecimal digits 0,.., 9 and a,.., f. (A,..,F may be used as alternatives for a,.., f.) A word constant (in decimal notation) is 0w followed by a non-empty sequence of decimal digits. A word constant (in hexadecimal notation) is 0wx followed by a non-empty sequence of hexadecimal digits. }}} Source: Milner R., et al. "The Definition of Standard ML. Revised." MIT (1997) Thus "0xw9" is invalid.
On 23.02.15 14: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