There is one small problem with this fix, as you have not modified the tokeniser it will allow you to write things like:<br><br>test1() -><br> A ! ! B.<br><br>test2() -><br> A !<br><br> ! B.<br><br>Which does look a little strange. :-)
<br><br>Robert<br><br><div><span class="gmail_quote">On 15/08/07, <b class="gmail_sendername">Joe Armstrong</b> <<a href="mailto:erlang@gmail.com">erlang@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
yes indeed very easy !! needs a one line addition to erl_parse.yrl<br><br><br>Find erl_parse.yrl (in stdlib/src)<br><br>Look for a line like this:<br><br> expr_100 -> expr_150 '!' expr_100 : mkop('$1', '$2', '$3').
<br><br>Then add the following<br><br>expr_100 -> expr_150 '!' '!' expr_100: {call, line('$1'),{atom,<br>line('$1'), rpc},['$1', '$4']}.<br><br>This turns all calls A !! B into rpc(A, B)
<br><br>Build a new parser<br><br>> erlc erl_parse.yrl<br>> erlc erl_parse.erl<br><br>test with (for example)<br><br>-module(bang).<br><br>-compile(export_all).<br><br>test1() -><br> a !! b.<br><br>rpc(A, B) ->
<br> {hello, A, B}.<br><br>$erl<br>> c(bang).<br>> bang:test1()<br>{hello, a,b}<br><br>This way you can redefine !! as you please by using an appropriate<br>-import(xyz, [rpc/2]) in your code<br><br>*remember* !! is addictive - so don't forget to remove !! from programs you
<br>distribute, since you need a non-standard parser to parse the sources.<br><br>(I guess we need a -use_parser(Mod) annotation in the code :-)<br><br>Question (to Joel) can't the entire Obj c interface be made dynamic using
<br>obj_sendMsg???<br><br>The call [obj with:i str:@"abc"]<br><br>can be built dynamically using something like<br><br>int i;<br>NSString s;<br>i = 1234;<br>s = @"hello"<br>obj_sendMsg(obj, NSSelectorFromString(@"with:str:", &i, s)
<br><br>and the type signature can be found introspectively - I think this is<br>how Fscript does it<br><br>Cheers<br><br>/Joe<br><br><br><br><br><br>On 8/12/07, Ulf Wiger <<a href="mailto:ulf@wiger.net">ulf@wiger.net</a>
> wrote:<br>> This looks like Joe's "bang-bang" notation.<br>> Joe made a small change to the parser to make this possible.<br>> He first wrote about it in <a href="http://www.sics.se/~joe/nerl.html">
http://www.sics.se/~joe/nerl.html</a>,<br>> I think.<br>><br>> BR,<br>> Ulf W<br>><br>> 2007/8/12, Joel Reymont <<a href="mailto:joelr1@gmail.com">joelr1@gmail.com</a>>:<br>> > Folks,<br>> >
<br>> > Suppose I wanted !! to send a synchronous message via a function<br>> > call. How would I write a parse transform to do it?<br>> ><br>> > I would like x !! y to be transformed into mod:func(x, y). Is this
<br>> > possible?<br>> ><br>> > Thanks in advance, Joel<br>> ><br>> > --<br>> > <a href="http://wagerlabs.com">http://wagerlabs.com</a><br>> ><br>> ><br>> ><br>
> ><br>> ><br>> > _______________________________________________<br>> > erlang-questions mailing list<br>> > <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> >
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>> ><br>> _______________________________________________<br>> erlang-questions mailing list
<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">
http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>