Enhanced type guard syntax]

Chris Pressey cpressey@REDACTED
Fri Sep 19 19:35:27 CEST 2003


On Thu, 18 Sep 2003 23:51:07 +0200
Klacke <klacke@REDACTED> wrote:

> On Thu, Sep 18, 2003 at 08:09:21AM -0700, Chris Pressey wrote:
> 
> > I think you CAN throw "when" completely away IF you take this new
> > syntax proposal to its logical extreme.
> > 
> >   foo(X, Y) when X == 2*Y
> > 
> > becomes
> > 
> >   foo(X == 2 * Y)
> > 
> 
> 
> Bad, uncomprehensible.
> 
> I don't see the point in this new propasal at all.

Brilliantly argued, sir!  :)

To clarify my position: I submit that

  foo(X > Y) ->

contains the exact same amount of information as

  foo(X, Y) when X > Y ->

while being more concise.

I also don't think it's any more difficult to read, once you unlearn the
arbitrary convention that "comma seperates arguments".

(Not that I'm proposing it for Erlang, since such a huge change would be
lethal to backwards-compatibility.  But as a language design idea in its
own right, I like it.)

-Chris



More information about the erlang-questions mailing list