Using ML Successor with SML / NJ

I was pleasantly surprised when I saw that SML / NJ had recently made some significant changes to version 110.79 , which is part of a move to something called ML Successor. It looks like a joint venture between SML / NJ and MLton and bodes well for the future of SML.

However, I am trying to use some of the new features that seem to be encountering a strange error (on 64-bit Windows 7). To try, I wrote the following in a file named sml_successor_test.sml:

Control.succML := true;
val n = 123_456;
print (Int.toString n);

when I try to load it into REPL using use "C:\Programs\sml_successor_test.sml";, the compiler does not work on the second line of the file (which uses the new type of numeric literal that should be included). But - when I immediately run the same command useas before, it works.

If you use Control.succML := true;REPL first and then use it useto upload a file (after deleting this line from the file), it works. On the other hand, if I just run SML, enable succMLand then assign val n = 123_456;directly to the REPL, it does not work the first time, but then it works.

To summarize - there seems to be a strange lag between when it Control.succML := trueis evaluated and when it takes effect, a lag that occurs in some contexts, but not in others. Any idea what is behind this and any workaround?

+4
source share
2 answers

This also happens with Mac OS X. However, I used a flag -Cparser.succ-ml=truein my alias sml, which behaves as expected:

alias sml="rlwrap /usr/local/bin/sml -Cparser.succ-ml=true"

I forgot what is equivalent to Windows. You may need to create your own sml script shell and place it before SML / NJ's PATH.

+2
source

. @IonutGStan script . VBScript SuccessorML.vbs :

Set WS = WScript.CreateObject("WScript.Shell")
WS.RUN("sml -Cparser.succ-ml=true")

, . , SML REPL -. sml . - run.

Windows sml .bat. , , sml succ-ml - SML .

+2

Source: https://habr.com/ru/post/1622450/


All Articles