[erlang-questions] Why is this expression illegal?
Fri Jan 18 15:19:07 CET 2019
My guess: allowing entirely arbitrary expression within binary
constructorsyntax could lead to ambiguities with respect to `/` and `-` and
`:` tokenswhich have special meaning in this context? Therefore only select
expressionforms are permitted, which are free of ambiguities, one of them
being `( E )`which in turn opens access to arbitrary expressions if one is a bit
So this will work:
4> << (case foo of foo -> 1; bar -> 2 end bor case foo of foo -> 8;
bar -> 16 end) >>. <<"\t">>
The file `stdlib-3.4.4/src/erl_parse.yrl` has the mechanics of it
(search for `binary`,`bin_elements`, `bin_element`) though not the underlying reasoning.
On Fri, Jan 18, 2019, at 15:04, Jeroen Koops wrote:
> Hi List!
> If this expressions is legal:
> case A of foo -> 1; bar -> 2 end bor case A of foo -> 8; bar -> 16
> ... and this expression is legal:
> << case A of foo -> 1; bar -> 2 end >>.
> ... then why is this expression illegal:
> << case A of foo -> 1; bar -> 2 end bor case A of foo -> 8; bar ->
> 16 end >>.>
> (shell responds with "* 1: syntax error before: 'bor'")
> Jeroen Koops
> M: koops.j@REDACTED
> T: +31-6-55590300
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions