user-defined operators

Martin J. Logan mlogan@REDACTED
Fri Mar 26 23:34:55 CET 2004


On Fri, 2004-03-26 at 16:18, Eric Newhuis wrote:
> This is orthogonal to user-defined operators.
> 
> One can already define confusing function names.  Consider:
> 
> dbg:ctpg(gq, x, 1) is no less confusing than {gq, x, 1} `@#` Blah.

I am just getting at the fact that if you have polymorphic functions and
you define your operators based on those functions then you naturally
have operator overloading. When you have overloading you have the
potential for the mess below.   | Which I would argue is worse.
                               \/

> 
> 
> > How about this?
> >
> >     N `@#` Primes
> >     Seconds `@#` 60
> >     MoreSeconds `@#` (Seconds `@#` String `@#` String2)
> >
> > I want my `operator` to be defined as such.
> >
> > '@#'(A, B) when is_integer(A), is_list(B) -> ...
> > '@#'(A, B) when is_integer(A), is_integer(B) -> ...
> > '@#'(A, B) when is_list(A), is_list(B) -> ...




More information about the erlang-questions mailing list