PackageDescription: Scripting


Last published: May 3, 2002 by 'tgriggs'

Defines 3 Classes
Extends 10 Classes

My purpose in life is to provide a Smalltalk script serialization mechanism. I'm meant to store relatively simple object trees as reexecutable Smalltalk code. Send asScript to anyObject and back comes something that should remanufacture me. This is similiar to storeString, but it is a bit easier to read the actual code. I also provide a special interpreter object which doesn't have the 255 literal limit and can automagically execute the setter: methods that don't really exist.


(Dictionary with: 1-> 2 with: 'hi' ->#there) asScript interpretScript

Is a full round trip cloning.

If you want to write a script to a file stream, you can use saveScriptOn:. You can override saveScriptOn: to issue your own Smalltalk instance recreation code. You can also filter variables automatically generated by overriding scriptStoredVariables. You can even execute self modifying scripts with this as well.

Dictionary new interpretScript: 'self add: 5 -> $4; yourself'