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

Christian S <>
Sun Aug 12 01:41:34 CEST 2007


It doesnt even parse, so the parse-transform cant work on it.

{ok, Tokens, Lines} =  erl_scan:string("foo(X) -> foo !! X.").
erl_parse:parse_form(Tokens).


It has been suggested before that the backtick or similar could be used
to create an infix operator out of an arity-two function, like in haskell.

X `add` Y vs add(X, Y)

or in your case

x `!!` y instead of '!!'(x, y)

http://www-users.cs.york.ac.uk/~mfn/hacle/issues/node2.html#SECTION00028000000000000000

I'm not all that crazy about the idea though. LispErlang would be cooler. :)

2007/8/12, Joel Reymont <>:
> Suppose I wanted !! to send a synchronous message via a function
> call. How would I write a parse transform to do it?
>
> I would like x !! y to be transformed into mod:func(x, y). Is this
> possible?
>
>         Thanks in advance, Joel



More information about the erlang-questions mailing list