((very) partial) enlightenment

Chris WRIGHT caw at cs.mu.oz.au
Thu Apr 19 12:23:51 UTC 2001


I posted a request for help a little earlier on. I needed to know how to
write some code that would allow Squeak code to be executed "on
demand"...A few hours of exploration later and I'm amazed! Python has a
nice explicit "eval" and "exec" pair of built-in functions that evaluate a
given piece of code (a string or byte-compiled) in a given global and
local namespace. 

Of course, in Squeak, all I had to do was store my snippets as blocks in
an instance variable of my Plan class and send them the value message when
ever I wanted them to execute...They seem to execute in the scope of their
instance. Woopeee!!

Actually, I initially found:

Compiler evaluate: aString for: theObject logging: trueOrFalse

and so I started loading up my snippets as strings, and that worked fin

So much to find out about! Thanks very much to the kind folk who patient
replied.

cheers

chris





More information about the Squeak-dev mailing list