Choking on Syntactic Sugar

Pekka Hedqvist <>
Tue Mar 13 10:35:50 CET 2001


It is documented:
http://www.erlang.org/doc/r7b/doc/extensions/part_frame.html

>-----Original Message-----
>From: 
>[mailto:]On Behalf Of Maurice Castro
>Sent: Tuesday, March 13, 2001 8:10 AM
>To: 
>Subject: Choking on Syntactic Sugar
>
>
>Hi All,
>	When writing a parser for Erlang we discovered an interesting
>construction in regexp.erl (line 121 in our somewhat older distribution).
>
>reg4([$.|S]) -> {{comp_class,"\n"},S};
>reg4("[^" ++ S0) ->
>    case char_class(S0) of
>        {Cc,[$]|S1]} -> {{comp_class,Cc},S1};
>        {Cc,S} -> throw({error,{unterminated,"["}})
>    end;
>
>It appears as if the ++ append operator has developed a new trick, it
>can be used to divide a string into 2 parts (just like Prolog).
>
>My question is in 3 parts:
>
>	1) is this behaviour desirable
>		- note it is pure syntactic sugar for [$[, $^ | S0]
>	2) is this behaviour intended
>	3) is it documented
>
>Comments welcome.
>
>	Maurice Castro
>




More information about the erlang-questions mailing list