On Nov 14, 2007 8:22 AM, Michele Simionato michele.simionato@gmail.com wrote: [...]
My expectation would be can a script can be executed by writing something like
#!/usr/bin/env alice print "Hello World\n"
and making the script executable, but this is clearly unsupported, since running that gives
$ ./hello.aml Alice 1.4 ("Kraftwerk 'Equaliser' Album") mastered 2007/04/24 ### loaded signature from x-alice:/lib/system/Print ### loaded signature from x-alice:/lib/tools/Inspector ### loaded signature from x-alice:/lib/distribution/Remote ### evaluating file /Users/micheles/md/ml/hello.aml hello.aml:1.0-1.3: unknown value or constructor `#!/'
Yes, the characters sequence #!/ is a valid symbolic identifier in SML. Also, the syntax # lab is special and explained on page 49 (60) of http://www.cs.cmu.edu/~rwh/smlbook/online.pdf .
Personally, particularly after having experienced the (very fast!) speed at which Poly/ML compiles code, I think that interactive SML implementations should simply add a non-standard special case for shebangs (perhaps with a suitable command-line argument). That would allow SML to be used as a powerful scripting language. In practice, ordinary SML source files never start with the symbolic identifier #!/.
-Vesa Karvonen