CaretForm mystery
Tim Olson
tim at jumpnet.com
Tue Feb 3 01:48:08 UTC 1998
Matt wrote:
>The puzzling critter is CaretForm.
>
>It looks like it should be a class variable, but it is not defined as
>one in Paragraph or any of its superclasses. It is not a class instance
>variable either. It doesn't show up as a global in the Smalltalk
>dictionary. The explain message says that it can't explain it.
Yes, it does look puzzling. Here's the explanation:
If you look closely, the Paragraph class uses a pool dictionary called
TextConstants, which is defined and initialized (along with the
CaretForm) in the Text class. At the time that
Paragraph>>caretFormForDepth: was compiled, this dictionary existed, so
the compiler found the value for CaretForm and placed it in the literal
table for the CompiledMethod. Later, the TextConstants pool was
accidentally removed before the final 1.3 image was saved. However,
pre-existing CompiledMethods still held onto the literals used from that
pool -- that explains why the method runs correctly, but you cannot
re-compile it, explain CaretForm, etc.
One of the early messages about 1.3 mentioned the accidental removal of
the TextConstants pool -- to fix it, do:
Text initialize.
-- tim
More information about the Squeak-dev
mailing list
|