develooper Front page | perl.perl6.language | Postings from February 2004

Re: The Sort Problem

Thread Previous
From:
Damian Conway
Date:
February 15, 2004 16:01
Subject:
Re: The Sort Problem
Message ID:
403007FD.4070201@conway.org
Joe Gottman asked:

>    If we use this signature, won't the code
>         sort ('foo', 'bar', 'glarch');
> 
> attempt to use the first parameter as a Criteria?

No. Because a string like 'foo' wouldn't match the first parameter's type.


> Since sort has to be a multi sub anyhow, why don't we do
> 
>     multi sub *sort(Criteria $by : *@data) {...}
>     multi sub *sort( : *@data) { ...} # returns sort {$^a cmp $^b} @data

We probably should (from an implementation efficiency standpoint if nothing else).


Damian

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About