[MLton] patch for CM cc variable support?
Tom 7
twm@andrew.cmu.edu
Mon, 13 Feb 2006 16:14:30 -0500 (EST)
May I request this small change to the way that CM works in mlton? Right
now, there are no defined symbols whatsoever, which (as far as I can tell)
makes it impossible to use the conditional compilation system to make a CM
file that works with both mlton and the newest sml/nj.
file mlton/cm/parse.sml line 37:
-- old --
val lex =
Lexer.lexer {strdef = no,
sigdef = no,
fctdef = no,
fsigdef = no,
symval = fn _ => NONE}
(cmfile, ins)
-- new --
fun symval "MLTON" = SOME 1
| symval _ = NONE
val lex =
Lexer.lexer {strdef = no,
sigdef = no,
fctdef = no,
fsigdef = no,
symval = symval}
(cmfile, ins)
With this, I can write CM files like
group is
#if MLTON < 1
$/basis.cm
#endif
file.sml
etc.sml
that compile with both compilers. (Also, if anyone can think of a way to
achieve this without any change to mlton, I'm all ears!)
It might also make sense to modify line 408 of lexer.sml to return
SOME 0 for undefined symbols, as SML/NJ apparently does. I do understand
the desire to avoid the slippery and infinite slope of CM compatibility
hacks, however!
Thanks as always,
Tom
[ NEW! : http://tom7.org/ ]
[ OLD! : http://fonts.tom7.com/ ]