Choking on Syntactic Sugar

Maurice Castro maurice@REDACTED
Tue Mar 13 08:09:57 CET 2001


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