[squeak-dev] Re: How to do logging (was Re: Files documentation)

nicolas cellier ncellier at ifrance.com
Thu Nov 27 22:14:19 UTC 2008


Bert Freudenberg a écrit :
> 
> On 27.11.2008, at 18:44, Keith Hodges wrote:
> 
>> Hello All,
>>
>> I need a villainous superpower that I haven't needed before, can anyone
>> tell me how to achieve this.
>>
>> I have some code like this:
>>
>> self send a message to me.
>> self nextThing.
>>
>> or
>>
>> self send a message to me.
>> A := self nextThing.
>>
>> What naughty superpower code can I put in to #send that will jump
>> execution to self nextThing directly?
> 
> 
> send
>     ...
>     thisContext sender jump: 4
> 
> This skips 4 bytecodes in the calling method before returning, so 
> instead of pc=31 it continues at pc=35:
> 
> 29 <70> self
> 30 <D4> send: send
> 31 <D3> send: a
> 32 <D2> send: message
> 33 <D1> send: to
> 34 <D0> send: me
> 35 <87> pop
> 36 <70> self
> 37 <D5> send: nextThing
> 38 <87> pop
> 39 <78> returnSelf
> 
> - Bert -
> 
> 

Maybe something like a classical doesNotUnderstand: handling...
A SilentMessageAbsorber could return self if it doesNotUnderstand: a 
message, so implement
send
     ^SilentMessageAbsorber new

That's not exactly direct, rather nop...

Nicolas




More information about the Squeak-dev mailing list