[erlang-questions] Parse-transforming !! to a function call

Vlad Dumitrescu vladdu55@REDACTED
Thu Aug 16 11:46:30 CEST 2007


Hi,

On 8/16/07, Joe Armstrong <erlang@REDACTED> wrote:
> Since we can *hide* rpcs through function abstraction, we cannot easily see
> which function calls are "real function calls" and which are (disguised) rpcs.
> [snip]
> If you write
>
>      abc !! {glurk, A, B}
> or
>     Pid !! {glonk, A]
>
> then this is apparent.

Well, this isn't quite true. Since !! would expand to calling rpc/2,
it all depends on what this function does -- it would do a rpc only by
convention.

> > if the server does not respond at all. For how long shall the client
> > wait? If we want a timeout , how should that be specified with that
> > syntax etc. etc.?
>
> Easy.
>    A !! B is defined to expand to rpc(A, B) in the local module - *nothing else*
>
>    -module(a)
>    -import(lib1, [rpc/2]).
>
>    f() ->
>        abc !! def.
>
> So we can customise the meaning to whatever we want. We could also add
> a local definition - giving the timeout value etc. what you want.

That would mean that you can't have two !! calls from the same module
that use different options, wouldn't it?

That said, I too think this kind of notation would help streamline not
only the code, but also the coder's thoughts. However, I think it
should be more than just a simple sugar coating on a local call to
rpc/2. [No, sorry, I don't have an answer to the follow up question,
it's just my feeling]

best regards,
Vlad



More information about the erlang-questions mailing list