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