in reply to Re: Re: my versus our in nested regex
in thread my versus our in nested regex

Agreed. Quite why strictness doesn't propogate to regex code blocks is a good question.

You can always enable it yourself:)

P:\test>perl -le"my $re = qr[(??{ use strict; $re })];" Global symbol "$re" requires explicit package name at (re_eval 1) line + 2. Compilation failed in regexp at -e line 1.

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!

Replies are listed 'Best First'.
Re: Re: Re: Re: my versus our in nested regex
by demerphq (Chancellor) on Oct 18, 2003 at 18:10 UTC

    Well, these constructs are experimental. Their behaviour is possibly subject to change in 5.10. Recently Abigail-II posted a doc change patch to p5p to have them no longer marked so, and the 5.10 pumpking rejected it on the grounds that it was one of his intentions to sort out a number of issues related to these constructs and that he couldnt guarantee that their behaviou would be unchanged by doing so. So, use the constructs if you wish, but be aware that you are using beta quality code.

    PS, im guessing Hugo will try Real Hard to keep them as close to their current behaviour as possible, but given one of his major objectives of 5.10 is massive improvements to the regex engine its anyones guess what will happen. Hugo, if you're reading this, good luck mate. :-)


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


      The question was more a case of, "I wonder why strict doesn't propogate to regex code blocks?", rather than "Why woudln't 'they' let it propogate?"... but your point is taken. It will be nice to see the extended features legitimised, whatever final form they take.

      I wonder what chance there is of getting a "capture to named vars" contruct added?


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Hooray!

        I wonder what chance there is of getting a "capture to named vars" contruct added?

        I mentioned it once on p5p, but to a deafenaning silence. It would be lovely though wouldn't it? Although I can see how there might be serious questions about how it should work. What should happen if there are identical named sections? Where should the results be stored? Possibly %+ or something? Also I can see some of the p5p saying "Perl is not going to use the dotNet syntax."

        :-)


        ---
        demerphq

          First they ignore you, then they laugh at you, then they fight you, then you win.
          -- Gandhi


Re: Re: Re: Re: my versus our in nested regex
by Anonymous Monk on Oct 18, 2003 at 18:36 UTC
    So it would seem that castaway could trivially implement strict compliant code without all the so-called bother that thus ensues:
    #!/usr/bin/perl -w use strict; 1 =~ m{(?{{ $foo = 42; $bar = 2; print $foo * $bar, "\n"; }})};
    ;)

      Indeed! ++

      I bet that's one use of a regex that won't make it into the next edition of japhy's book:)


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Hooray!