Erlang is getting too big

Richard Carlsson richardc@REDACTED
Tue Oct 14 14:12:14 CEST 2003


On Tue, 14 Oct 2003, Thomas Lindgren wrote:

> A question on #6 below: shouldn't it be that the guard
> _fails_ if a subexpression crashes?

D'oh! (I need more coffee.) Yes, of course: if a subexpression
crashes, it quietly evaluates to *false*, thus failing the test.

(And may I repeat: Please don't use this for anything!)

> Anyway, a couple of short comments:
>
> 1. Do we WANT to unify guards and expressions?
> Personally, I think it might be good, but not if the
> solution is messier than what it replaces. It's not a
> "must have" for me.

The point, I think, is to try to get nearer to the principle
of least surprise. The way guards were originally defined,
there were lots of surprises in store, once you went beyond
the simple "f(X) when integer(X) -> ..." ones.

> 2. Assuming that we do:
>
> Another approach to unifying guards with expressions
> would be to introduce the appropriate type tests as
> BIFs. Apart from float/1, this seems straightforward?

Well, the "is_..." forms are BIFs, but I assume you mean
to keep the names integer(X) etc. and also introduce them as BIFs.
But since auto-recognized BIFs override local definitions (sic!),
this would probably break a lot of existing code.

	/Richard


Richard Carlsson (richardc@REDACTED)   (This space intentionally left blank.)
E-mail: Richard.Carlsson@REDACTED	WWW: http://user.it.uu.se/~richardc/
 "Having users is like optimization: the wise course is to delay it."
   -- Paul Graham



More information about the erlang-questions mailing list