Executing AST

mmille10 at comcast.net mmille10 at comcast.net
Thu Jul 12 06:50:48 UTC 2007


Norbert Hartl wrote on 2007-07-08:

"I must confess I was too fast and too lazy (as often )while writing my
postings. I don't need serialization/deserialization exactly. I only
have objects which are persistent in a database and therefor have an
id (could be any lookup key). I just need something to dump a derivate
of the object (recognizing the object and the lookup key) and that is
able to retrieve again at a later point. The harder point is that it
would be useful to produce such derivates from a structure like a 
collection or anything else. I don't know of any Smalltalk solution
which helps me on that path, do you?"

Hi Norbert.

Without more information I think we're just "stabbing in the dark" at an answer for you. Could you give an example of what you want to do?

>From what I've surmised so far it sounds like you'd like to store expressions in the database, and retrieve them back out again. What I imagine you'd also like to do is take database data associated with the expressions and perhaps do some sort of substitution into your expressions, and then evaluate them at some point. Does this sound right?

I'm just wondering if you're making it more complicated than it needs to be, to accomplish what you want.

As Alan Kay indicated earlier, you can evaluate expressions on the fly, like:

| block blockInString |
blockInString := '[Transcript show: ''Hello world''; cr]'.
block := Compiler evaluate: blockInString for: BlockClosure logged: false.
block value

If you keep your expressions inside blocks then you can always just say "for: BlockClosure" in the evaluation step to keep it simple.

---Mark
mmille10 at comcast.net



More information about the Squeak-dev mailing list