----- Original Message -----
From: "Damian Conway" <[EMAIL PROTECTED]>
To: "Larry Wall" <[EMAIL PROTECTED]>
Cc: "Perl 6 Language" <[EMAIL PROTECTED]>
Sent: Sunday, February 15, 2004 5:59 PM
Subject: [perl] Re: The Sort Problem
> Here's a proposed syntax and semantics for C<sort> that tries to preserve
the
> (excellent) features of Uri's "on the right track" proposal whilst
integrating
> it into the Perl 6 design without multiplying entities (especially
colons!)
> unnecessarily.
>
> Suppose C<sort>'s signature is:
>
> type KeyExtractor ::= Code(Any) returns Any;
>
> type Comparator ::= Code(Any, Any) returns Int;
>
> type Criterion ::= KeyExtractor
> | Comparator
> | Pair(KeyExtractor, Comparator)
> ;
>
> type Criteria ::= Criterion
> | Array of Criterion
> ;
>
> multi sub *sort(Criteria ?$by = {$^a cmp $^b}, [EMAIL PROTECTED]) {...}
>
If we use this signature, won't the code
sort ('foo', 'bar', 'glarch');
attempt to use the first parameter as a Criteria? Since sort has to be a
multi sub anyhow, why don't we do
multi sub *sort(Criteria $by : [EMAIL PROTECTED]) {...}
multi sub *sort( : [EMAIL PROTECTED]) { ...} # returns sort {$^a cmp $^b} @data
Joe Gottman