Larry Wall wrote:
How can you have a level independent position?%+ and %- are gone. $0, $1, $2, etc. are all objects that know where they .start and .end. (Mind you, those methods return magical positions that are Unicode level independent.)
The matching itself happens at a specified level. (Note that which level the match happens at can change what is matched.) So it makes sense that all the positions that come out of it are in terms of that level.
Now, that position can be translated to a lower level, but not to an upper level, since you can happily land in the middle of a char.
This is part of what I'm having trouble with your concept of a Str being at several levels at once: There's no reliable way to have a notion of "position", expect to have it as attached to the highest possible level, and the second someone does something at lower level, you void the position, and possibly the ability to remain at that high level.
I still see my notion of a Str having only one level and encoding at a time as being preferable. Having the ability to recast a string to other levels/encoding should be easy, and many builtins should do that recasting for you.
I do _not_ see $/ & friends getting ported across a recasting. .pos can be translated if new level <= old level, otherwise gets set to undef.
Please convince me your view works in practice. I'm not seeing it work well when I attempt to define the relevent parts of S29. But I might just be dense on this.
-- Rod Adams