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

Richard O'Keefe ok@REDACTED
Mon Oct 4 06:24:00 CEST 2010


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.




More information about the erlang-questions mailing list