[Seaside] Re: Seaside & Ruby Rails Compared
Colin Putney
cputney at wiresong.ca
Thu Sep 8 03:06:00 CEST 2005
On Sep 7, 2005, at 7:23 PM, goran at krampe.se wrote:
> Hi!
>
> Victor Rodriguez <victor.palique at gmail.com> wrote:
>
>> But how do you keep your object instances inside the image, in a
>> global variable?
>>
>> Let me ask this again, is there a recommended way of doing this?
>>
>
> Well, I would say class variables is the "most common" way to hold
> onto
> "global state".
> For example, SMSqueakMap holds your map in a class var called
> DefaultMap.
True, but I wonder if this goes to the question...
Victor, you don't have to do anything special to "keep your object
instances inside the image." Try this experiment:
- Open up your favourite Squeak image.
- Open a workspace.
- Type "2 raisedTo: 1024", select it, and choose "inspect it" from
the context menu. An inspector window will open on a very large
number. This number is an object, of class LargePositiveInteger.
- Save and quit the image.
- Open the image again.
- The inspector, and the object it's inspecting is still there. As
long as the inspector is open, the object will still be in the image,
even across different invocations of the VM.
- For even more fun, choose "debug it" from the workspace menu. Step
through a few message sends in the inspector, then save the image.
When you come back you can continue debugging the calculation you
started earlier. This is because all the stack frames in a Smalltalk
process are objects, and get stored in the image as well. This is why
the image model is so useful - you just can't do this sort of thing
in "traditional" languages like Java, Ruby or C++.
Hope this helps,
Colin
More information about the Seaside
mailing list