[Q] Any reason why there is no "BlockContext >> storeOn:" ?

Markus Gaelli gaelli at emergent.de
Thu Oct 30 20:04:46 UTC 2003


Hi Julian,

> BlockContexts are very dependant on the context in which they were 
> created.  We can refer to variables in that scope.  While you might be 
> able to write out [1 + 1], how do you write out [foo + 1] ?  I have no 
> idea what/if any the solutions for this are, but I'm pretty sure 
> that's the reason it isn't done at the moment.  It's just not as 
> simple as writing out the source code that was used when creating the 
> block; the entire context at that point needs to be captured.

Thanks, and right, I was forgetting the variables, as I would not need 
them.
I remember now, that in SIXX "Context Objects" are also not  serialized.

But I guess, if you can just write out the source, depends on what you 
want:
Either you recreate the block out of its storestring anywhere or in the 
right context.
In the later case I think the source-code should do the trick, no?

I am wondering when you need the former.

So let's call it "definitionString" for the moment.

Now I am puzzled how to write a BlockContext >> definitionString
that satisfies the following:

a:={[1+1].[1+2]. [(Point x: 2 y: 2) * 2]}.
aCol := a collect: [:e | e definitionString ].
self assert: [aCol first= '[1+1]'].
self assert: [aCol second = '[1+2]']
self assert: [aCol third = '(Point x: 2 y: 2) * 2']

(Test driven development, I write the test, who makes it run? :-)

Markus

>> I wanted to get the store-string of say
>> [1+1] , which should yield '[1 + 1]'.
>> Any reason why "BlockContext >> storeOn:" is not implemented?
>> Can I go ahead and "just do it"?
>> Thanks,
>> Markus
>
>
>




More information about the Squeak-dev mailing list