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

Re: Binding hashes to arrays?

Thread Previous
From:
Larry Wall
Date:
July 30, 2005 08:07
Subject:
Re: Binding hashes to arrays?
Message ID:
20050730150725.GD22860@wall.org
On Sat, Jul 30, 2005 at 02:59:02PM +0200, Ingo Blechschmidt wrote:
: Hi,
: 
: is binding hashes to arrays (or arrays to hashes) legal? If not, please
: ignore the following questions :)
: 
:     my @array  = <a b c d>;
:     my %hash  := @array;
: 
:     say %hash<a>;         # b
:     push @array, <e f>;
:     say %hash<e>;         # f?
:     %hash<X> = "Y";
:     say ~@array;          # ???
:     # <X Y> (or X => "Y"?) appended to the end of @array?
: 
: It seems to me supporting this is hard to get right...

As with the scalar binding I'm inclined to disallow it for now.
Our theme this year: "Be strict now--we can always relax it later."

Of course, I shall probably violate that myself when I get around to
answering Autrijus on return type checking...

Larry

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