At 02:13 PM 4/20/2001 -0500, Jarkko Hietaniemi wrote:
> > 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 &&).
>
>Maybe.  I agree on the || and &&, I want them be overloadable, too,
>but what does that have to do with comparison operators?  My poor
>brain just doesn't see the utility of being able to separately
>overload lt and le.  <pinching>   Ahhh, okay, for example some
>funky datatype where < and <= have to have the *same* semantics.
>Awwwwright.

I'm thinking that we're going to have one cmp-style vtable comparison 
function for strings and one for numbers. Anything else and people can go 
override the parser if they really need to.

>One additional datapoint to overload your brain with is to consider
>the ambiguity of equality and comparison.  Unicode normalization:
>is A + grave equal to Agrave?  Is Agrave less than Aacute? Unicode
>collation combined with language/locale-specific rules.

Comparisons on Unicode data will do it on the Unicode collation version of 
the string data. Equality checking will be done either on normalized data 
or whatever representation it's in, depending on Larry's call. (I'd prefer 
normalization form C, but I'm not sure the regularity's worth the CPU cost. 
Telling the programmer to beware might be sufficient)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to