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

Re: Question about list context for String.chars

Thread Previous | Thread Next
From:
Rod Adams
Date:
April 11, 2005 22:00
Subject:
Re: Question about list context for String.chars
Message ID:
425B55D0.4080407@rodadams.net
Matt Diephouse wrote:

>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.
>  
>
I've been meaning to ask what people thing about having operators that 
temporarily change the "current lexical Unicode level" for just one 
single expression. I see them as solving all kinds of corner cases.

Unfortunately, I don't have a solid proposal handy, which has kept me 
from posting it. But since there is some interest in this, I'll throw 
the concept out there, and see if anyone else has a good idea what they 
should look like, and exactly how they should work.

-- Rod Adams


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