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

Re: Valid hash keys?

Thread Previous | Thread Next
Alex Burr
February 27, 2005 16:23
Re: Valid hash keys?
Message ID:
On Sun, Feb 27, 2005 at 11:57:30PM +0100, Thomas Sandlaß wrote:
> Alex Burr wrote:
> >[..] Actually, it would be useful sometimes
> >to be able to give a hash an explicit canonicalizer:
> >
> >my %msdos_files is canonicalized_by lc;
> >
> >my %fractions is canonicalized_by gcd;
> Shouldn't that be handled by container subclasses of Hash?
> Like PersitentScalar or SparseArray?

Possibly. Clearly that's what one would do in any other language.
What I was thinking was that if hashes are going to have a
canonicalizer function *anyway*, maybe the default implementation
could be overridable with a trait (or role?). But I can't 
actually claim to have followed perl6 development enough to
be able to argue that it really makes sense.


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