[Nickle] Polymorphic equality and similar mysticism

Bart Massey bart at cs.pdx.edu
Mon May 31 09:19:00 PDT 2004

In message <E1BUcxS-00073Z-00 at brudder.east.isi.edu> Carl
Worth wrote:
> On Sun, 30 May 2004 17:03:35 -0700, Bart Massey wrote:
> >                  The next question with that is whether to
> > also consider the return type in the disambiguation.
> > but most languages only consider arguments: I'm not sure I
> > know why.
> Because functions are often called for their side effects and the return
> value is ignored?

Conceivably.  But the same argument applies to ambiguous
function arguments in languages that have them.  I should
be able to pass a poly argument to an overloaded Nickle
function and still have it select the right operator if the
other argument tells me how.

In the current Nickle implementation where the only builtin
operators overloaded are arithmetic, it's hard to
observationally distinguish this from runtime type checking,
but at least
  poly plus_ip(int x, poly y) { return x + y; }
compiles while
  poly plus_vp(void x, poly y) { return x + y; }
does not.

(BTW, I note that the old "function" keyword still works as
a substitute for "poly" in this context.  This cracks me up,
as it's what my fingers typed for me the first time.  We
quit using "function" how long ago?)


More information about the Nickle mailing list