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

Reply via email to