in reply to Re^3: Why are 5.10's named captures read only? (step 3)
in thread Why are 5.10's named captures read only?
I don't really understand how exposing the offsets and length would not be the full abstraction.
Given a way to look up the number of a named match, it is easy to precisely determine the offsets (it is just an array look-up in @+ and @-). Just having a way to look up the offsets doesn't allow you to reliably determine the number of the match.
So I would prefer that the mapping from name to number be exposed over the mapping from name to offsets. And one more hash that you use to look up offset inside of @+ and @- almost seems a better interface than exposing a pair of hashes or a hash that contains values that are two-element arrays anyway.
- tye
|
|---|