Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Why are 5.10's named captures read only? (step 3)

by ambrus (Abbot)
on Oct 20, 2008 at 20:39 UTC ( [id://718303]=note: print w/replies, xml ) Need Help??


in reply to Re^2: 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. Exposing the number of the numbered capture might still be a better interface even that way.

  • Comment on Re^3: Why are 5.10's named captures read only? (step 3)

Replies are listed 'Best First'.
Re^4: Why are 5.10's named captures read only? (step 3)
by tye (Sage) on Oct 20, 2008 at 23:00 UTC
    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        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://718303]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2026-02-07 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.