[erlang-questions] Extensions to comprehensions eeps

Anthony Shipman als@REDACTED
Thu Jul 31 11:35:50 CEST 2008


On Thu, 31 Jul 2008 05:59:27 pm Vlad Dumitrescu wrote:
> 2008/7/31 Hynek Vychodil <vychodil.hynek@REDACTED>
>
> > There is functional difference, between <- and <= is not functional
> > difference.
> > There is not reason why
> > [X || <<X>> <- <<"abc">> ].
> > should not return same result as
> >
> >  > [X || <<X>> <= <<"abc">> ].
> >
> > "abc"
>
> Hi,
>
> I might be mistaken here, but I think the issue is that the compiler
> generates completely different code for each case and when the generator
> looks like X <- Y, i.e. the right side is not a constant, it has to know
> which one to produce. The compiler can't guess from the source code,
> because for example <<X>> <- L is a very normal list generator, one can't
> assume L is a binary.
>
> best regards,
> Vlad

Or they could define some virtual machine instructions for iterating over 
collections so that the compiler's generated code is the same for all cases.

-- 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.



More information about the erlang-questions mailing list