sends don't block, right?

Shawn Pearce <>
Wed Feb 25 15:08:30 CET 2004


Or really alter the language to allow:

	Pid !! Message after Timeout -> n end.

Yuck.  I can't believe I just wrote that pile of garbage.

Never mind, VERY bad idea.

I'm sold on the local RPC function.  Have at it
they-who-maintain-the-compiler.

Joe Armstrong <> wrote:
> 
> On Wed, 25 Feb 2004, Vlad Dumitrescu wrote:
> 
> > From: "Joe Armstrong" <>
> > >   If you use !!  at the top  level of your code then you can "see" the
> > > RPC - my brain goes (RPC this  might be slow - take care, and RPC this
> > > will synchronize any outstanding asynchronous  message) - so I can see
> > > what I'm doing.
> > 
> > You make a very nice argument for the !! operator, while explaining some basic
> > Erlang philosophy. If only it was easy to specify timeouts, I'd be sold!
> > 
> > /Vlad
> > 
> 
>   I wondered about the following:
> 
>   If we make the following one line addition to erl_parse.yrl:
> 
>   expr_100 -> expr_150 '!' '!' expr_100:
>      {call, line('$1'),{atom, line('$1'), rpc},['$1', '$4']}.
> 
>   Then A !!  B just gets expanded into the  *local* function rpc(A, B)
> and  the user is  free to  add their  own definition  of rcp/2  to the
> module concerned.
> 
> So in one module I might say:
> 
>    rpc(Pid, Q) ->
>        Pid ! {replyTo, self(), replyAs, Pid, Q},
>        receive
> 	   {Pid, Reply} ->
> 	       Reply
>        end. 
> 
> In another
> 
>    rpc(Pid, Q) ->
>        Pid ! {self(), Q},
>        receive
>    	 {Pid, Reply} ->
>    	    Reply;
>        after 1000 ->
>    	    exit(oops)
>        end. 
> 
> In another
> 
>    -include("rpc1.hrl").
> 
> In another:
> 
>    rpc(Pid, Q) ->
>    	gen_server:call(....)
> 
>   This is more or less how I program - I want all the !!'s to work the
> same way in a given scope. ie all of then have timeouts or none, etc.
> 
> /Joe
> 

-- 
Shawn.

  Fortune's Real-Life Courtroom Quote #3:
  
  Q:  When he went, had you gone and had she, if she wanted to and were
      able, for the time being excluding all the restraints on her not to
      go, gone also, would he have brought you, meaning you and she, with
      him to the station?
  MR. BROOKS:  Objection.  That question should be taken out and shot.



More information about the erlang-questions mailing list