[erlang-questions] Adding new operators?

David Goehrig <>
Sat Apr 13 21:44:10 CEST 2013


On Wed, Apr 10, 2013 at 12:31 PM, Anthony Ramine <> wrote:

>
> For example he could write a parse transform for a parallel send operator
> like this:
>
>         +[Pids/parallel] ! Message.
>
> This is beyond ugly but at least it's quite obvious that some spooky
> action at the distance is going on.
>

This isn't as ugly as one might think.. Say

erl_scan:string(" Pids @! Message ").

yields

{ok,[{var,1,'Pids'},{'@',1},{'!',1},{var,1,'Message'}],1}

and

erl_scan:string(" Pids #! Message ").

yields

{ok,[{var,1,'Pids'},{'#',1},{'!',1},{var,1,'Message'}],1}

these I can transform into something reasonable ... and @! as parallel
array send and #! and parallel hash send have a sort of Perlish beauty to
them :)

AFAICT neither @! nor #! mean anything in existing erlang code as both are
syntax errors (which in this case is a good thing).

Dave


-=-=-=-=-=-=-=-=-=-=- http://blog.dloh.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130413/d01fa68e/attachment.html>


More information about the erlang-questions mailing list