Contribution to the record- and write-your-own-guards debates

Luke Gorrie luke@REDACTED
Thu Jul 10 15:50:15 CEST 2003


"Fredrik Linder" <fredrik.linder@REDACTED> writes:

> I often find myself forced to unnecessary nesting in my code due to the fact
> that I am disallowed to write my own guards.
> 
> I usually write ADTs to conceil my data bearers, which is a practis I find
> very good since it nicely divides my code into good working bricks. But
> since I am disallowed to write my own guard-functions I cannot match
> directly on those ADTs, but have to explicitly extract the information and
> then match on these values instead.

This particular problem could be helped by the rumoured "cond"
construct. It's like 'if', but uses arbitrary expressions for the
tests instead of more restricted guard expressions.

I reckon 'cond' would/will be very nice :-)

Cheers,
Luke (now a big fan of Common Lisp's type system btw)




More information about the erlang-questions mailing list