[e-lang] Is the SuchThatPattern always a bad idea?

Darius Bacon darius at accesscom.com
Mon Aug 8 01:44:23 EDT 2005


Mark Miller <markm at cs.jhu.edu> wrote:
> If we dispense with getSynEnv(), then there's no reason to keep the guard 
> qualifier coupled to a variable definition pattern. Instead, without 
> increasing the size of the language, and while being upwards compatible from 
> the present language, we could generalize the guard qualifier to appear to the 
> right of any pattern.
> 
> If '<p1>' is the pattern '<p2> :<e2>', then the meaning is, first evaluate 
> <e2> to a guard, coerce the specimen by this guard, and then match the 
> coercion result against <p2>.

Doesn't this break left-to-right evaluation if <p2> happens to have
embedded expressions?  I guess you could handle this by statically
disallowing patterns where this would matter -- I think you've already
made that sort of rule for other Kernel-E expansions.

Or, ugh, you might evaluate-but-don't-yet-match-on <p2> before
evaluating <e2>.  I think there's no precedent in E for that kind of
evaluation.

Darius


More information about the e-lang mailing list