This is my first post to the mailing list (although some of you may have
seen my name on comp.lang.functional or comp.lang.python) and I would
like to document some of my frustrations while using Alice for the first
time. I wanted to write an "Hello Word" program in Alice. I expected to do so
in 1 minute, instead I had to spend on hour or so and I am not even sure I
did the right thing. I think you should add some additional
information on the Web
site on how to run standalone scripts (if it is there, is should be
made more visible, since I could not find it).
Here is what I did.
1. I started alice from the command line, then I wrote
- print "Hello World\n";
Hello World
val it : unit = ()
and it worked, so I was happy.
2. Then I wrote an one-line program:
$ cat hello.aml
print "Hello World\n"
and tried to run it:
$ alice 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
val it : unit = _future
As you see, "Hello World" was not printed.
3. When I saw the line "val it : unit = _future" I thought, perhaps this
happens because of lazyness in importation of module (?), so I tried
$ echo hello.aml
await print "Hello World\n"
but nothing changed :-(
4. Then I thought "maybe I need to put a declaration" and I
changed my program to:
$ echo hello.aml
val () = await (print "Hello World\n")
I run it and this time I got
$ alice 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
i.e. there was not _future, but "Hello World" was not printed either :-(
5. I started looking at the documentation on the Web site and I could not find
how to run scripts(!). There was documentation on how to compile components,
so I tried that, and I changed my program to
$ echo hello.aml
structure Hello = struct
do print "Hello World\n"
do OS.Process.exit (OS.Process.success)
end
and I run it as follows:
$ alicec hello.aml && alicerun hello.alc
Hello World
This worked, but it seems overkill to me, after all, I would expect
a script to be interpreted directly. So I believe there is a simpler
way. 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 `#!/'
So, please write in some visible place that the shebang is not
supported and what is the suggested way to write standalone scripts.
For the rest, Alice looks extremely cool and I am certainly will have
more questions to ask as I progress with it.
Thanks for the attention,
Michele Simionato
_______________________________________________
alice-users mailing list
[email protected]
http://www.ps.uni-sb.de/mailman/listinfo/alice-users