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

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



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 });
"done".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 });
	}

to

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

it works as expected.

best,
adc
--
--
Alberto de Campo
Bergstrasse 59/33
A-8020 Graz, Austria
e-mail : decampo@xxxxxx
--