Message-Passing
Sean Kelly
sean at invisibleduck.org
Thu Jan 26 17:06:33 PST 2012
On Jan 26, 2012, at 1:19 PM, Manu wrote:
> On 26 January 2012 22:07, Sean Kelly <sean at invisibleduck.org> wrote:
>
> What I like about "receiveOnly" is that the name itself suggests that anything other than the specified type is not expected, and so some measure will probably be taken.
>
> Again, this only makes sense to me if you already expect that the act of receiving (as a compliment to the send API, which you've already invoked and have a presumption about), was capable of receiving any/multiple things, rather than receiving what you just sent a few lines back...
>
> receive!T says to me "look for a message of this type and block if it's not present."
>
> Perfect. It says that to me too. I'm lost now though, this is the behaviour of receiveOnly... are you agreeing now? :)
It's only the behavior of receiveOnly if the queue is completely empty. If it contains any other message, receiveOnly will throw. But from what you've said I think this is simply a difference in how we design apps. For me, it's common to send multiple message types. For you, it sounds like it is not.
More information about the Digitalmars-d
mailing list