Hello list, is there any way to detect that DNU message was sent by VM , as result of failed method lookup, not intentionally by language side?
I need to have a pseudo-class which intercepts _any_ message you sending to its instance, including #doesNotUnderstood: sent directly by language side. Of course, i can't do anything with messages which handled directly by VM , such as #class , but at least i want to make sure that rest of messages is intercepted with guarantee.
On Mon, Nov 24, 2008 at 2:08 PM, Igor Stasenko siguctua@gmail.com wrote:
Hello list, is there any way to detect that DNU message was sent by VM , as result of failed method lookup, not intentionally by language side?
I need to have a pseudo-class which intercepts _any_ message you sending to its instance, including #doesNotUnderstood: sent directly by language side. Of course, i can't do anything with messages which handled directly by VM , such as #class , but at least i want to make sure that rest of messages is intercepted with guarantee.
Spoon has one of these; it involves VM modifications. Craig made a *special* class that the VM is aware of, which captures any message sent to it. I believe it'll capture every sent message.
Otherwise, it might be possible to kludge together a message catcher which uses various techniques to detect special messages sent to it. I remember doing something like that to catch >>ifTrue: and friends somehow using exceptions (I forget). You could probably detect #doesNotUnderstand: by determining whether the sender actually sent #doesNotUnderstand: explicitely somehow by looking at thisContext and tracing back to see what the sent selector was.
Gulik.
i think i found the way..
AlmostTransparentProxy class>>new
| anonClass | anonClass := self clone. anonClass superClass: self ; methodDict: nil. ^ anonClass basicNew
Then if i do:
proxy := AlmostTransparentProxy new.
on any message i sending to proxy, i'll get #cannotInterpret: message. And event if you send #cannotInterpret: from language, it will receive #cannotInterpret: with message selector == #cannotInterpret: :)
2008/11/24 Igor Stasenko siguctua@gmail.com:
Hello list, is there any way to detect that DNU message was sent by VM , as result of failed method lookup, not intentionally by language side?
I need to have a pseudo-class which intercepts _any_ message you sending to its instance, including #doesNotUnderstood: sent directly by language side. Of course, i can't do anything with messages which handled directly by VM , such as #class , but at least i want to make sure that rest of messages is intercepted with guarantee.
-- Best regards, Igor Stasenko AKA sig.
squeak-dev@lists.squeakfoundation.org