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

Re: Stringification, numification, and booleanification of pairs

Thread Previous | Thread Next
From:
Juerd
Date:
September 25, 2005 04:01
Subject:
Re: Stringification, numification, and booleanification of pairs
Damian Conway skribis 2005-09-24  8:31 (+1000):
> They ought to, since the two are different in Perl 5.
> For example:
>     my @bar = 'bar';
>     print "foo[@bar]baz\n";
>     print "foo[" . @bar . "]baz\n";

This does not compare stringification to interpolation. It compares
scalarification to interpolation. Interpolation (stringification) was
needed because Perl 5's arrays weren't as smart as Perl 6's, and didn't
usefully stringify in string scalar context.

 @foo

 Context   Perl 5   Perl 6
 numeric   number   number
 string    number   join
 scalar    number   ref

This huge difference in how smart an array is makes it kind of
useless to take Perl 5 as an example of how arrays should behave in Perl
6, because that would also dictate that "foo" ~ @bar end in the number
of elements in @bar. Bad idea.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About