develooper Front page | perl.perl6.language.data | Postings from September 2000

Re: RFC 196 (v1) More direct syntax for hashes

Thread Previous | Thread Next
From:
Michael G Schwern
Date:
September 7, 2000 21:37
Subject:
Re: RFC 196 (v1) More direct syntax for hashes
Message ID:
20000908003710.C25109@athens.aocn.com
On Thu, Sep 07, 2000 at 10:22:17PM -0600, Nathan Torkington wrote:
> Michael G Schwern writes:
> I was expecting those two crufty features to be removed.  If they
> aren't, a third won't hurt.

Might want to add this assumption to the RFC.  Or perhaps another RFC
to junk reset()'s current meaning.


> > > This would be equivalent to:
> > > 
> > >   foreach ($k,$v) (map { $_ => $hash{$_}
> > > 		   sort
> > > 		   keys %hash)
> > >   { ... }
> > 
> > What you proposed and what you put in your example doesn't quite play
> > out.  C<sort keys %hash> returns just the sorted keys of %hash, but
> > your foreach example implies that both keys and values would be
> > returned, sorted by key.  Both would be useful.  
> 
> That's what the map is for.  (modulo syntax error in the map :-)

Okay, the example says on thing and the text of the proposal says
another.

So you're proposing that C<sort %hash> act like C<map { $_ =>
$hash{$_} } sort keys %hash>?  I can live with that.  Just clear it up
in the RFC.

-- 

Michael G Schwern      http://www.pobox.com/~schwern/      schwern@pobox.com
Just Another Stupid Consultant                      Perl6 Kwalitee Ashuranse
<GuRuThuG> make a channel called Perl, and infest it with joking and
fun....it doesnt make alot of sense.

Thread Previous | Thread Next


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