develooper Front page | perl.perl5.porters | Postings from September 2009

replacing $[

Thread Next
From:
Zefram
Date:
September 27, 2009 00:21
Subject:
replacing $[
Message ID:
20090927072059.GN14049@fysh.org
I've just uploaded to CPAN a module, Array::Base, which reimplements
$[ without any core support.  The impatient can find it at
<http://www.fysh.org/~zefram/tmp/Array-Base-0.000.tar.gz>.

As previously proposed, it operates by hooking the op checkers for
aelem, aslice, and av2arylen ops.  (aelemfast is generated by the
base checker for aelem, and so does not need to be hooked separately.)
It works on perl 5.8.1 and later (except for a problem with lexical $_
affecting slicing on 5.9.1, which I only tested on out of curiosity).
It can't work on any earlier perl version, because aslice ops don't go
through the check process prior to 5.8.1.

It doesn't affect index and substr, as $[ does.  If anyone wants the
offset for those ops, I think it should be implemented as another module,
separate from the array one.

Can we get rid of $[ now?

-zefram

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