Idioms | How to send messages in Context?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Idioms | How to send messages in Context?

marcel.taeumel
Hi all!

Take a look at this:



When would a context use #send:to:with: and when just directly send it?

self send: #cannotReturn: to: self with: {value}.
self cannotReturn: value.

self send: #cannotReturn:to: to: self with: {value. self}.
self cannotReturn: value to: self.

There are other examples. See:
Context >> #jump:if:
Context >> #return:from:

Best,
Marcel


Reply | Threaded
Open this post in threaded view
|

Re: Idioms | How to send messages in Context?

Christoph Thiede

Hi Marcel,


#cannotReturn: is put onto the stack of the process being executed/simulated. #send:to:with: is part of the simulation protocol. Analogously, #resume:through: will appear on the executed process stack whereas #return:from: is used by the simulator as stated in the comment. :-) I think these methods are already arranged in two different protocols, which are "controlling" for the execution perspective and "instruction decoding" for the simulation perspective.


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 19. April 2021 11:32:53
An: squeak-dev
Betreff: [squeak-dev] Idioms | How to send messages in Context?
 
Hi all!

Take a look at this:



When would a context use #send:to:with: and when just directly send it?

self send: #cannotReturn: to: self with: {value}.
self cannotReturn: value.

self send: #cannotReturn:to: to: self with: {value. self}.
self cannotReturn: value to: self.

There are other examples. See:
Context >> #jump:if:
Context >> #return:from:

Best,
Marcel


Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Idioms | How to send messages in Context?

marcel.taeumel
Hi Christoph,

makes sense. Thank you!

Best,
Marcel

Am 19.04.2021 11:57:39 schrieb Thiede, Christoph <[hidden email]>:

Hi Marcel,


#cannotReturn: is put onto the stack of the process being executed/simulated. #send:to:with: is part of the simulation protocol. Analogously, #resume:through: will appear on the executed process stack whereas #return:from: is used by the simulator as stated in the comment. :-) I think these methods are already arranged in two different protocols, which are "controlling" for the execution perspective and "instruction decoding" for the simulation perspective.


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 19. April 2021 11:32:53
An: squeak-dev
Betreff: [squeak-dev] Idioms | How to send messages in Context?
 
Hi all!

Take a look at this:



When would a context use #send:to:with: and when just directly send it?

self send: #cannotReturn: to: self with: {value}.
self cannotReturn: value.

self send: #cannotReturn:to: to: self with: {value. self}.
self cannotReturn: value to: self.

There are other examples. See:
Context >> #jump:if:
Context >> #return:from:

Best,
Marcel


Reply | Threaded
Open this post in threaded view
|

Re: Idioms | How to send messages in Context?

timrowledge


>>
>> #cannotReturn: is put onto the stack of the process being executed/simulated. #send:to:with: is part of the simulation protocol. Analogously, #resume:through: will appear on the executed process stack whereas #return:from: is used by the simulator as stated in the comment. :-) I

It might be worth considering the names of these methods in order to make that very clear. Perhaps something like #simSend:to:with: ?


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Klingon Code Warrior:- 4) "This machine is a piece of GAGH! I need dual G5 processors if I am to do battle with  this code!"



Reply | Threaded
Open this post in threaded view
|

Re: Idioms | How to send messages in Context?

Christoph Thiede

It might be worth considering the names of these methods in order to make that very clear. Perhaps something like #simSend:to:with: ?


Yeah, I already thought about something like this. But this would be a greater refactoring, I guess. Another not-so-serious argument is that I have started using the "sim" prefix for extension methods on Context from SimulationStudio. :-)

Best,
Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von tim Rowledge <[hidden email]>
Gesendet: Montag, 19. April 2021 18:50:29
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] Idioms | How to send messages in Context?
 


>>
>> #cannotReturn: is put onto the stack of the process being executed/simulated. #send:to:with: is part of the simulation protocol. Analogously, #resume:through: will appear on the executed process stack whereas #return:from: is used by the simulator as stated in the comment. :-) I

It might be worth considering the names of these methods in order to make that very clear. Perhaps something like #simSend:to:with: ?


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Klingon Code Warrior:- 4) "This machine is a piece of GAGH! I need dual G5 processors if I am to do battle with  this code!"





Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Idioms | How to send messages in Context?

marcel.taeumel
In reply to this post by timrowledge
Hi Tim.

It might be worth considering the names of these methods in
> order to make that very clear. Perhaps something like #simSend:to:with: ?

Yes, "send" is very close to "perform" and #when:send:to: and #on:send:to:. :-D

Yet, we are in Context. So there is already a notion of "simulation" attached to many messages in there. Looking at the protocols "controlling" and "system simulation", I don't think that adding a "sim" prefix to "controlling" messages would do any good.

Best,
Marcel

Am 19.04.2021 18:50:40 schrieb tim Rowledge <[hidden email]>:



>>
>> #cannotReturn: is put onto the stack of the process being executed/simulated. #send:to:with: is part of the simulation protocol. Analogously, #resume:through: will appear on the executed process stack whereas #return:from: is used by the simulator as stated in the comment. :-) I

It might be worth considering the names of these methods in order to make that very clear. Perhaps something like #simSend:to:with: ?


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Klingon Code Warrior:- 4) "This machine is a piece of GAGH! I need dual G5 processors if I am to do battle with this code!"