[BUG][FIX][3.3] Morph>>updateableActionMap has wrong return value
Rob Withers
rwithers12 at attbi.com
Thu Apr 25 13:09:23 UTC 2002
Ned Konz <ned at bike-nomad.com> wrote:
> On Wednesday 24 April 2002 08:31 pm, Rob Withers wrote:
> > This weekend, I hope to continue with the WeakMessageSend we were
> > discussing, for the receivers and args. How does the finalization
> > mechanism work? Will it nil out garbage slots?
>
> Yes. So it's not clear what you should do when you have an argument
> slot that's nil. I guess you could keep flags saying which arg slots
> were supposed to be nil.
>
> That is: if someone makes a WeakMessageSend and passes in an argument
> that is only held onto by the arguments array in the WMS, then it
> will be GC'd and the slot will become nil.
>
> This kind of error will be hard to debug, which is why I'd recommend
> having a bitflag (say) that marks the position of desired nils in the
> args array.
>
> You could disallow sending messages to nil (I can't imagine that such
> messages are very useful). So the receiver could go away and you
> could detect it (and signal a meaningful exception, or just not do
> the call).
I think this is as far as we took the discussions the last time. when
#valuewitharguments: is sent, we could go through the correct
marshalling of arguments, then verify that all fields that aren't
supposed to be nil, meet that criteria.
> Depending on whether you want to be able to change the arguments after
> you create a WMS, you might be able to get away with this:
>
> Object weakSubclass: #WeakMessageSend
> instanceVariableNames: 'selector '
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Kernel-Objects'
>
> and keep the receiver and the arguments in the indexed slots. But
> you'd have to know the number of args at construction time to call
> new: .
So a weak subclass has indexed slots, like an array? I notice that
Array is a variableSubclass, which does have indexed slots. What does a
weakSubclass do?
> If you don't mind using become: you could even change the number of
> arguments. I think. Though I don't know if you can use become: with a
> weak object.
>
> Or you could use a WeakArray to hold onto the arguments and/or
> receiver. That way you could make a new one if someone wanted to
> change the number of arguments.
I was thinking this might be the way to go, since the arguments in a
MessageSend are held in an array, anyway. It looks like #weakSubclass:
is how one defines the WeakArray class, so it must have indexable slots.
cheers,
Robert
More information about the Squeak-dev
mailing list
|