develooper Front page | perl.perl6.language | Postings from May 2001

Re: Apoc2 - Context and variables

Thread Previous | Thread Next
From:
Edward Peschko
Date:
May 4, 2001 20:47
Subject:
Re: Apoc2 - Context and variables
Message ID:
20010504204740.A14728@excitehome.net
On Fri, May 04, 2001 at 11:23:12PM -0400, John Siracusa wrote:
> On 5/4/01 11:09 PM, Nathan Wiger wrote:
> > The real trick is what to do with these:
> 
> Note: stabbing wildly here... :)
> 
> > %a = (%b, %c);
> 
>     %a = (stringify(\%b) => \%c); # Perl 5-ish
>     %a = (%b.str => %c);          # Perl 6 equiv.
> 
> > %d = (@e, @f);
> 
>     %d = (stringify(\@e) => \@f); # Perl 5-ish
>     %d = (@e.str => @f);          # Perl 6 equiv.
> 
> > Or, horrors:

Horrors is right. The default perl5 behaviour is *useful*. I use the %b=(%a,%c)
metaphor all of the time.

Why not just keep it simple? And perl5-ish. Two contexts, scalar and list, 
hashes NOT a context of its own. If 

	%a = @b;

does 

%c = map{ ($_ => undef ) }  @a;
	
then it both confuses things and gets rid of lots of regular expression tricks,
example:

%environment = (`env` =~ m"(.*?)=(.*)\n"sg);

Ed

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