Front page | perl.perl6.internals |
Postings from July 2002
Re: we need more ops.
From: Nicholas Clark
July 29, 2002 02:46
Re: we need more ops.
Message ID: 20020729104535.U38407@plum.flirble.org
On Sun, Jul 28, 2002 at 06:59:50PM -0700, Sean O'Rourke wrote:
> On Sun, 28 Jul 2002, Nicholas Clark wrote:
> > On Sat, Jul 27, 2002 at 08:07:50PM -0700, Sean O'Rourke wrote:
> > > Whether plain cmp (as a vtable function or an op on PMCs) should be kept
> > > at all is questionable -- there's no way to get at it syntactically from
> > would be a regexp match. In effect =~ would be a builtin cmp with dispatch
> > based on the types of both sides, preferring to compare as integers, then
> > floating point, then strings, then regexps, then ...
> > But even if perl6 wants this (and I can't remember if it's been officially
> > suggested that it might), I'm not convinced that it's something that needs
> > a vtable entry in the low level types of every PMC.
> I would also guess that this logic will end up at a higher level, whether
> figured out at compile time or in some non-vtable method at runtime. And
> actually, the smart-match table in A4 doesn't mention anything for object
> types, so I'm not sure where this one is headed. In any case, =~ doesn't
> say anything about ordering, whereas cmp() does, and we already have an
> unordered is_equal() vtable method that will cover =~.
D'oh. I forgot the important bit. The logical follow-through of all this is
that there would be a <~> operator. or whatever the <=> turns into when it's
~ [and I've no idea what sort of name that is]
[Maybe we should have a competition to suggest the most crazy three character
operator - ie state your sequence of three characters (not necessarily ASCII,
but it helps), state their name, and state their purpose (including whether
listop, binop, uniop, precedence, associativity or whatever else helps make
your entry more humorous. So presumably there could be a :-) operator, but
offhand I can't think of something plausible it could do. And does the
tie-fighter need an X-wing operator to complement it? (not sure what that
one would look like, let alone what it would do)]