Jarkko Hietaniemi wrote:
> 
> >       // numeric comparisons
> >       int   (*NUMCMP)     (SVAL *this, SVAL *value);
> >       int   (*NUMEQ)      (SVAL *this, SVAL *value);
> >       int   (*NUMNE)      (SVAL *this, SVAL *value);
> >       int   (*NUMLT)      (SVAL *this, SVAL *value);
> >       int   (*NUMGT)      (SVAL *this, SVAL *value);
> >       int   (*NUMLE)      (SVAL *this, SVAL *value);
> >       int   (*NUMGE)      (SVAL *this, SVAL *value);
> 
> I'm not certain about the utility of having separate EQ NE LT GT LE GE.
> If those are not deducible from CMP, we don't have a consistent comparison
> function (we might get loops).

I'm not sure the exact Perl 5 internal rep., but right now 'use
overload' already allows individual overloading of all the numeric and
string equality functions individually:

    o Comparison operations
         "<",  "<=", ">",  ">=", "==", "!=", "<=>",
         "lt", "le", "gt", "ge", "eq", "ne", "cmp",

      If the corresponding "spaceship" variant is available,
      it can be used to substitute for the missing operation.
      During "sort"ing arrays, "cmp" is used to compare
      values subject to "use overload".

It looks like Branden took the vtable names from RFC 159, which is a
modification of 'use overload' ops to object member functions. During
our discussions of this on -objects, I remember Damian emphasizing that
you want as much granularity as possible with anything that's overloaded
(especially concerning the ability to overload || and &&).

Anyways, just a little more background info on this one point. The
proposal is huge but very cool, haven't had a chance to digest the whole
thing yet...

-Nate

Reply via email to