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

Re: Question about list context for String.chars

Thread Previous | Thread Next
From:
Matt Diephouse
Date:
April 11, 2005 21:41
Subject:
Re: Question about list context for String.chars
Message ID:
198c87380504112141ec83279@mail.gmail.com
On Apr 12, 2005 12:20 AM, gcomnz <gcomnz@gmail.com> wrote:
> > Rod wrote:
> > However, I do like the idea of treating a string as an array of chars. I
> > remember some discussion a while back about making [] on strings do
> > something useful (but not the same thing as C<substr>), but I forget how
> > it ended, and my brain is too fried to go hunt it down. But overall I
> > like that idea. Then you could just say:
> >
> >     @array = $string[];
> 
> This all sounds nice and simple. My only question then is what about
> the instances where you specifically need the array of graphs, codes,
> bytes, or whatever? If we can do one, why not all?

That's why C<$string.chars[]> was proposed -- it would be accompanied
by .graphs, .codes, and .bytes. That is all fine and dandy, but I
don't think I should have to think about unicode if i don't want to.
And if I understand correctly, that means that I want everything to
use chars by default. And C<$string[]> would be a nice shortcut for
that.

-- 
matt diephouse
http://matt.diephouse.com

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