On Wed, 11 Jun 2008 15:06:24 +0300, Marc Feeley feeley@iro.umontreal.ca wrote:
How did you enter the code for evaluation? Did you type it in to PLT's REPL and loaded it from a file in Gambit?
No. I typed it in notepad, then loaded it from the file in both cases.
The behaviour of Gambit's "load" is to treat the content of the file as a complete sequence of commands/expressions. It is as though the sequence was wrapped in a "begin" form. Equivalently, in this case, it is as though the whole code was in the body of a toplevel procedure definition which is called once, as in:
I understand why. I was just surprised by the difference in behavior.
I'm actually surprised that PLT does not do the same. Most probably PLT's "load" is modeled on the REPL (i.e. it is a read-eval-print loop which simply takes its input from a file).
The thing is that in PLT, at the top level, (coco 13) will return 13
I think Gambit's model is cleaner, as it allows to have the same semantics for load whether the file being loaded is source code or compiled code.
I asked because it is not clear to me if there is some standard that prescribe how the top level should behave and I was surprised by the different results. In both cases I've run the file by calling (load "test.scm").
Thank you.
________ Information from NOD32 ________ This message was checked by NOD32 Antivirus System for Linux Mail Servers. part000.txt - is OK http://www.eset.com