develooper Front page | perl.perl6.language | Postings from July 2006

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

Thread Previous | Thread Next
Larry Wall
July 13, 2006 12:50
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
On Thu, Jul 13, 2006 at 09:32:08PM +0300, Yuval Kogman wrote:
: [1] My preferred ergonomics:
: 	1. eqv goes away
: 	2. what was eqv is renamed to ===
: 	3. === becomes =:=, which has a "constant" feel to it
: 	4. =:= is rarely useful IMHO, so you can just type
: 	variable($x) =:= variable($y)

It is important for eqv to be alphabetic so we can have the functional
form take an optional signature parameter to specify what is compared.

    eqv($a,$b, :($x,$y))

Think of this as the same as the sort specifier that says what to sort on,
only we're only interested in eqv-ness rather than cmp-ness.

In fact, cmp (or something like it) also wants to take a third parameter:

    leg($a,$b, :($x is num,$y is rev));

and then sort is just done with the same signature:

    sort :($x is num,$y is rev), @foo;

or some such, however you want to canonicalize the records.
The sort routine can decide whether it'll be more efficient to do
various transforms or maneuvers based on the declarative syntax of
the signature.

Then $a eqv $b and $a leg $b both just default to a signature that selects


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About