Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Perl5 patches

by BrowserUk (Patriarch)
on Mar 18, 2012 at 11:23 UTC ( [id://960280]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl5 patches
in thread Perl5 patches

It looks like the change was a deliberate choice in response to the issues raised 9 or 10 years ago by my earlier posts on the issue of lvalue refs.

As far as I'm concerned, lvalue refs have never been made to work the way they intuitively should. And the way they do work entirely limits their usefulness. Limits it to the point of almost uselessness. The utterly unnecessary wholesale duplication of referenced substring is just mockery.

And taking a look into the current implementation of substr it is no wonder that it is so slow. The result of all the different tweaks and modifications over the years by so many different hands attempting to fix the lvalues refs; signed/unsigned 32-bit offsets and unicode problems -- further compounded with the stupid indentation -- make it look like it was coded by a rank beginner with no concept of basic coding principles -- like DRY.

The only way to fix it -- and all the problems that still afflict it -- would be to start again from scratch. And we both know the likelihood of that ever happening.

The only solution I can think of is to write a module that overrides CORE::GLOBAL::substr and implements it in a sane fashion. But given the overhead of calling back into perl, that's not going to be performant either.

All in all, it's a depressing state of affairs.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^3: Perl5 patches
by Corion (Patriarch) on Mar 18, 2012 at 11:34 UTC

    You can override CORE::GLOBAL::substr from C as well.

    Approaching that issue with a separate rewrite would be the approach to take in my eyes. That way, the replacement can conveniently be tested against CPAN before the change is merged back into mainstream Perl.

      You can override CORE::GLOBAL::substr from C as well.

      Any pointers?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        I tried something on my own and failed. Then I remembered overload::eval, which does that, except for OP_ENTEREVAL. If you replace OP_ENTEREVAL with OP_SUBSTR, that should be all you need, save for the rewrite of substr. But then you can step-wise refine it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found