Enhanced type guard syntax]

Eric Newhuis enewhuis@REDACTED
Thu Sep 18 13:22:05 CEST 2003


This is a wonderful suggestion.  I would welcome it.  Furthermore I 
would also welcome compile-time checking in cases where it is 
practical.  Such a small thing could be a stepping stone to some 
ultimate type system.

> foo(A/integer, B/integer) ->
>      A * B.

What is the runtime expense of performing such checks?

The technique I employ is liberal use of unit tests so I can avoid type 
checking at runtime and gain a slight performance advantage.  But 
perhaps this is an illusion?  What is the real expense?

Would this lead the way to a user-defined type system some day, one that 
even supports recursive type definitions?

-type (blammo, [atom() | blammo()]).
foo (A/blammo, B/blammo) ->
    blammize (A, B).

Maybe I've been hanging around ObjectiveCAML too much.  M. Logan 
probably thinks I'm crazy.  ;-)

-e





More information about the erlang-questions mailing list