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

Robert Virding rvirding@REDACTED
Sat Aug 25 01:32:48 CEST 2007


On 25/08/07, Jeff Rogers <dvrsn@REDACTED> wrote:
>
> Mats Cronqvist wrote:
> > On 2007-08-16 10:52, Joe Armstrong wrote:
> >> [...]
> >> (Actually we dont use ? any more so we could say A ? B instead of A !!
> B
> >>  this might be even better - it saves one character and the ? clearly
> >>  indicates the intent)
> >
> >    if only... but as far as i know '?' is munched by the preprocessor.
> >
> >    also, i think that if anything '?' should be used instead of
> > 'receive' (the way God, or at least Tony Hoare, intended).
> >
> >    mats
>
> Could a parse transform recognize the case where the value A ! B is not
> discarded and change those cases into some kind of synchronous call?  So
> that
>
> A = spawn(...),
> A ! whatever,
> ok.
>
> is a async call but
>
> A = spawn(...),
> B = A ! whatever,
> B.
>
> is a synchronous call.  The return value of ! is normally just the value
> that was sent, which doesn't seem very useful.  The only places where it
> would not be immediately evident if the return value is ignored is when
> a function or Fun evaluates to a send.  Even so, ! normally looks like
> an imperative operator more than a functional one so this seems to make
> it more functional (but also lazy in some respects, which is
> anti-erlang/soft-rt)


That would result in forcing people to write some really weird code. I could
never for example just end a function with a normal async send as that would
be interpreted as sync  send.

Generally the idea of having the semantics of something change depending on
what comes after seems a little off.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070825/361727e2/attachment.htm>


More information about the erlang-questions mailing list