Enhanced type guard syntax]

Peter-Henry Mander erlang@REDACTED
Fri Sep 19 11:06:18 CEST 2003

Hi Vlad,

Vlad Dumitrescu wrote:
> The idea is certainly interesting, but one problem that I can see is that one
> has to either
> - return {list_of_integers, Value} from all functions that compute such a beast

Not necessarily, for example:

    sum({list_of_integers, Value}) -> ... {integer,Sum}.


    sum({list_of_integers, Value}) -> ... Sum.

is a design issue.

Or am I missing your point?

This scheme must be applied throughout where "types" are required for it 
to work, and I agree that it can become tiresome to write, but design it 
right and it will save some pain later.

If you return tagged types, it will force users of the function to honor 
the type scheme, and isn't that what the goal is?


> or
> - be forced to write
>         Result = fun_that_returns_a_list_of_integers(),
>         f({list_of_integers, Result}),
>   instead of
>         f(fun_that_returns_a_list_of_integers()),
> The big advantage of using the real types and not tags is that they are present
> in the runtime, while invisible in the code.
> regards,
> Vlad

More information about the erlang-questions mailing list