Something that I realized few minutes later i sent the email, in a coffee break with marcus
Thanks, Alexandre On 19 Jun 2009, at 16:08, Lukas Renggli wrote: >> The following code freeze the image, and I have no idea why. >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> Object compile: 'foo ^ Point new'. >> pointAssociation := (Object >> #foo) literals first. >> self assert: [pointAssociation isKindOf: Association]. >> self assert: [pointAssociation value == Point]. >> pointAssociation value: Color. "<-- this is the dangerous line" >> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= >> >> If I try to do "Object new foo", the whole image freezes. >> >> Any idea why? > > Class bindings are shared among the system dictionary and all code > that references them. This mechanism is central so that code with > undeclared references can be compiled and automatically resolves later > on without having to re-compile the complete system. > > Your code changes the binding of Point to point to Color. Obviously > that's fatal. After executing your code, Point is an alias to Color > and the actual Point class is garbage-collected. > > To make your code work you need to replace the complete literal with > > Smalltalk associationAt: #Color > > Cheers, > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
