[squeak-dev] TraitResource the cause of many Trait test failures

Frank Shearar frank.shearar at gmail.com
Wed Apr 10 18:09:20 UTC 2013


There's an AttemptToWriteReadOnlyGlobal in TestResource >> #setUp,
which is a bit strange, given that #setUp is supposed to set up this
read only global in the first place.

It looks like TraitResource uses its createdClassesAndTraits instvar
to remember what to remove... only it never actually stores any of
t1..t6 or c1..c8 in that instvar. So I ripped out the instvar and
replaced the createdClassesAndTraits method with one that returns
those traits and classes that aren't nil.

That reveals that when the trait's created, computation eventually
ends up in Environments >> #at:put:. That calls a block with this:

    binding := aSymbol => anObject.
    contents add: binding.
    exports bind: binding

and it's in #bind: that the AttemptToWriteReadOnlyGlobal is signalled.
And indeed, if we call the Environment in which we're working env,
((env exports instVarNamed: 'namespaces') at: #T1) = AnObsoleteT1.

And now I'm stuck. A BindingPolicy provides no means of removing a
binding (and I don't even know if that makes sense).

frank

PS There is a lot of cruft in the TraitsTestCase, duplicating some of
TraitsResource. Cleaning that out doesn't make the problem worse, but
I haven't submitted a decrufting fix because I don't want to add
noise.)


More information about the Squeak-dev mailing list