[squeak-dev] possible Environments bug

Chris Muller asqueaker at gmail.com
Wed Oct 2 20:05:13 UTC 2013


Given class hierarchy:

Object
    Fred

I wanted a new class-hierarchy with Wilma between Object and Fred.

Object
    Wilma
          Fred

But I knew most of Fred's methods would remain up in Wilma, only 2 or
3 would go to Fred.  So the way I changed the class hierarchy was:

  1) Rename Fred to Wilma.
  2) Make new subclass of Wilma, named Fred.
  3) Move 2 or 3 methods to Fred.

After adding Fred back I now find that all references to Fred class in
existing methods now actually point to the Wilma class.  What actually
happened is the variable binding in Smalltalk for #Fred had value ->
of the Wilma class.

So I guess the rename updated all references in existing methods to
Wilma (but shouldn't they have been Undeclared?).

Tricky to fix, too, since its a read-only binding plus you can't
simply reference Fred anymore at all.  I had to:

   [ (Smalltalk association at: #Fred) value: (Smalltalk
allClassesAndTraits detect: [ : e | e name = #Fred) ]
      on: AttemptToWriteReadOnlyGlobal
      do: [ : noti | noti resume: true ]


More information about the Squeak-dev mailing list