Luke Palmer <[EMAIL PROTECTED]> writes:

> Gautam Gopalakrishnan writes:
>> Hello,
>> 
>> I've tried the archives and the 'Perl 6 essentials' book and I can't
>> find anything
>> about string subscripting. Since $a[0] cannot be mistaken for array subscripting
>> anymore, could this now be used to peep into scalars? Looks easier than using
>> substr or unpack. Hope I've not missed anything obvious.
>
> Well, no, it can't really.  $a[0] now means what Perl 5 called $a->[0]
> (or @$a[0]).  So it's still an array subscript, it's just subscripting
> $a, not @a.

So, it should be possible to define 

  method postcircumfix:[] is rw { ... }

in the String class to do the right thing? Or even to define it in some
Sequence trait that both arrays and strings share? Of course, the
putative method would have to take into account the calling context's
Unicode behaviour, but I can't see why it shouldn't be possible.

Reply via email to