Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion The .bytes/.codepoints/.graphemes methods
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt Diephouse  
View profile  
 More options Jun 30 2004, 8:51 pm
Newsgroups: perl.perl6.language
From: m...@diephouse.com (Matt Diephouse)
Date: Wed, 30 Jun 2004 20:51:58 -0400
Local: Wed, Jun 30 2004 8:51 pm
Subject: Re: The .bytes/.codepoints/.graphemes methods

Larry Wall wrote:
> On Sat, Jun 26, 2004 at 12:27:38PM -0700, Brent 'Dax' Royal-Gordon wrote:
> : Issues:
> :   * Limits lvalue substr (doesn't allow it to be a different size)
> :     unless splice is used (or a substr method is also provided).

> That all has to be looked at anyway.  What does "5" mean when you
> pass it to substr, anyway?  (I've been trying to make it assume some
> implicit unit based on the current lexical scope's Unicode level,
> but issues remain.)  We have magical string positions that have
> different numeric values depending on what units you view them as,
> but at what point does a number like "5" get translated to such
> a magical string position?

While we're on the topic of substr, allow me to beg. Please, can we
replace substr with with array style operations like Ruby and Python?
Please? Something like this would be nice:

  my $string = "Hello, World!";
  say $string[0..4]; # prints "Hello\n"
  $string[7...] = "Larry!";
  say $string; # prints "Hello, Larry!\n"

We already have our strings acting as objects, and we have [] as a
postcircumfix operator, so it's something that someone could define
easily. Of course, I have no idea how to reconcile this with all the
talk of unicode other than to say that the easy stuff should be easy.

It just follows this would also be nice for arrays, to replace splice.
For me, these two functions are the most bothersome part of Perl 5, and
I would love to see them go.

matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.