Enhanced type guard syntax]
Vlad Dumitrescu
vlad_dumitrescu@REDACTED
Thu Sep 18 16:16:12 CEST 2003
Joe wrote:
> Adding guards like this violates one of my favorite design
> meta-principles: " If you add something to a language you have to chuck
something
> away "
>
> What are we going to chuck away? Well not "when ->" ... Since you can't
say
> foo(X, Y) when X == 2*Y ->
> in the new syntax
> So you keep "when" - now there are TWO ways of saying things
> foo(A/integer, B/integer)
> or
> foo(A, B) when is_integer(A), is_integer(B) ->
> and people will write:
> foo(A/integer, B) when is_integer(B) ->
> ...
> etc.
Why not throw away the "when is_integer()" guards? Let type be only be specified
using the new syntax, and let other kind of guards be specified as before. It
seems to me it should work. What do you think?
Of course, this would break backwards compatibility. Since I'm not at Ericsson
(anymore) I can happily propose to write a tool for automated conversion of code
to the new format. :-)
regards,
Vlad
More information about the erlang-questions
mailing list