[F-Script-talk] Problem with variables defined in block
Brought to you by:
pmougin
From: <kmo...@sp...> - 2003-09-15 17:36:52
|
Hi, I'm new to fscript, and stumbled upon something that really puzzles me. =20= When I define a block directly from the prompt within the =20 fscript-application, and define a variable within that block, the =20 variable will be visible outside the block, too (after the block has =20 been sent 'value'). This is as I expected it. See this session for =20 example: --------------------------------------------------------------------- > blockFromPrompt :=3D [ otherString :=3D 'this works!'. ] > blockFromPrompt value > otherString 'this works!' --------------------------------------------------------------------- However, when I load a block from a file, any variable defined in this =20= block will NOT be visible outside. Compare this: --------------------------------------------------------------------- > codeFromFile :=3D NSString alloc initWithContentsOfFile: =20 '/Users/dunk/Desktop/testScript.fscript' > blockFromFile :=3D codeFromFile asBlock > blockFromFile [ someString :=3D 'test me!'. ] > blockFromFile value > someString error: undefined identifier "someString" --------------------------------------------------------------------- Why is the 'someString' variable not visible, just as the 'otherString' =20= variable? Is this a bug or a feature? If it is a feature, I don't =20 really get it. Someone please enlighten me! =3D8-) Apart from that, I think that fscript is very cool! I plan to use it in =20= a game project of mine. Cheers, Knud PS: I use version 1.2.4 ------------------------------------------------------------------------=20= ------- Knud M=F6ller - Institut f=FCr Sprachliche Informationsverarbeitung, Universit=E4t zu K=F6ln (Department of Linguistic Data Processing, University of Cologne, =20 Germany) http://www.spinfo.uni-koeln.de/~kmoeller |