[erlang-questions] List comprehension filter expressions not throwing exceptions

Anthony Shipman <>
Mon Oct 4 11:23:44 CEST 2010


On Mon, 4 Oct 2010 03:24:00 pm Richard O'Keefe wrote:
> On 4/10/2010, at 11:00 AM, Robert Virding wrote:
> > The reason for this behaviour is that the compiler specially handles
> > filters which are also valid guard tests. After a generator then all the
> > *directly* following filters which are valid guard tests are handled as
> > guards to the generators and not as "normal" tests. While this is more
> > efficient it does lead to the inconsistencies you discovered in the case
> > of errors in the filter tests.
> >
> > It seemed like a good idea at the time. I don't know if it is possible to
> > change this today, if one wanted to.
>
> It would be better to be consistent about this.
> If only bindings Pattern <- Expr and guard tests were allowed,
> general filters could still be hacked using
> 	true <- [Boolean_Expression]
> and everyone would know exactly where they stood.
>
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

I think it would seriously reduce the usefulness if I couldn't have function 
calls in the filter tests.

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


More information about the erlang-questions mailing list