[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Weird bug with Dictionary-atFail

OK, good diagnosis.

I think I'm going to commit the ?? {} version because ?? is inlined now, so it will be faster than passing the function into atFail.


On Saturday, Nov 6, 2004, at 16:00 US/Eastern, Alberto de Campo wrote:

Dictionary-atFail is broken. It works when called by itself, but the reference in Object-dependants causes very weird behavior.

Point(0, 0).dependants

You would expect this to output nil, but instead it posts a blank line.

Point(0, 0).dependants.inspect

Also outputs a blank line -- the object inspector does not open.

Point(0, 0).dependants.do({ "loop".postln });

You would expect this to post "done" -- but it doesn't.

The bug is fixed by changing Object-dependants, removing the call to atFail:

	dependants {
		^dependantsDictionary.at(this) ?? { ^IdentitySet.new };

actually, the problem is ithe second return in Object.dependants. if you change it from

	dependants {
		^dependantsDictionary.atFail(this, { ^IdentitySet.new });


	dependants {
		^dependantsDictionary.atFail(this, { IdentitySet.new });

it works as expected.

Alberto de Campo
Bergstrasse 59/33
A-8020 Graz, Austria
e-mail : decampo@xxxxxx
sc-dev mailing list


H. James Harkins /// dewdrop_world

"If attacked by a lion, thrust your arm down his throat.
This takes some practice."  -- Cyril Connolly