[erlang-questions] Extensions to comprehensions eeps

Richard A. O'Keefe <>
Fri Aug 1 02:13:30 CEST 2008


On 31 Jul 2008, at 10:05 pm, Hynek Vychodil wrote:
> I understand it, but I think this is wrong design decision. Compiler  
> optimization should not impact language design, especially in so  
> clear functional language as Erlang is.

Clearly you do not understand bitstring generators in Erlang.
THIS IS NOT A COMPILER OPTIMISATION.
Bitstring generators and list generators have fundamentally
different semantics.

> do_it(L) when is_list(L) -> [X+1, <<X>> <- L];
> do_it(B) when is_binary(B) -> [X+1, <<X>> <- B]. % [X+1, <<X>> <= B]
>
> should be same as
>
> do_it(Y) -> [X+1, <<X>> <- Y].

Except in this one specific and not very useful case
(iterating over bytes), this cannot possibly work.
Bitstring generators are NOT limited to iterating over
bytes.





More information about the erlang-questions mailing list