Since my mail server has been down for a week, I've had a lot of time
to look through Perl 6 as it stands, without being concerned with
"current issues."  I'll do them one-message-at-a-time (and rather
slowly, too).

The first thing I noticed was the == / eq distinction.  This has been
invaluable for scripting, but since Perl 6 is desiring to be more of a
formal language, I'm wondering whether the distinction is profitable.
In generic programming (my specialty :), it is very useful to have a
standard sort of equality[*] that all participating objects define.

The problem is that there's I<two> kinds at the moment, and for all
but simple scalars, the distinction is fuzzy.  Sure, you could say
that == always compares the numerical representations, and eq compares
the string representations, but this breaks down for more complex
concepts.

The solution that springs to mind is to conform to other languages'
thought and make == polymorphically compare equality.  Thanks to
context-forcing, the string/numeric distinction is still there, at the
expense of a little extra verbosity:

    +$a == +$b;  # Numeric compare
    ~$a == ~$b;  # String compare
     $a ==  $b;  # Generic compare

Then we could also use eq for real identity, if we wanted to.

[*] Not to mention, identity.  The current $a.id == $b.id is
unsatisfactory as I see it, but that's a different issue.

Luke

Reply via email to