http://www.perlmonks.org?node_id=1039558


in reply to Capturing parenthesis and grouping square brackets

I admit to laugh, quite openly, when I read things (in the linked article) such as ... “there are things about regex culture that need breaking.”   That is truly spoken like someone who doesn’t have a million lines of in-service legacy code to maintain.   “Yee, hah, let’s go changing the fundamental meaning of the language to make it (according to me, and the rest of you are wrong) –er.”   If you think I’m going to approve a budget-dime for that, or lobby for it to be approved, you’re nuts.

That’s why Perl-6 is still, stillborn.   Because a programming language, really, is quite a small thing compared to the vast amount of in-service application and CPAN-library code that is out there.   (The market value of which, I think, rests easily in the billions of dollars.)   There is no evolutionary transition-plan here; not does one appear to be possible, let alone economical, let alone particularly beneficial.   It would be very nice (may-be) if it were otherwise, but it isn’t.   The syntax may be “ugly,” but there are by-now millions of examples of it in $$$ervice.

Replies are listed 'Best First'.
Perl 6 <-> Perl 5 bridges (was Re^2: Capturing parenthesis and grouping square brackets)
by raiph (Deacon) on Jun 19, 2013 at 05:02 UTC
    Edited to clarify. Added another couple examples of support for transition.

    TL;DR Perl 6 accords Perl 5 special status, with many elements specifically designed to make P5/P6 interop straightforward. And, for those who want it, transition.

    There is no evolutionary transition-plan here; not does one appear to be possible, let alone economical, let alone particularly beneficial.

    Imo the ways in which P6 design and implementation bridges with P5 demonstrate great care about interop and evolutionary transition at both a big picture and tiny detail level.

    First, sticking to just regex:

    It's not just regex either:

    Please visit the IRC channel #perl6 on freenode and help improve it by constructively discussing things you think will improve transition or interop between P5 and P6. Thanks go to Larry, jnthn, and all who try to help. Illegitimi non carborundum! :)

      "Perl 6 match objects"? OK, not that I think Perl6 actually matters, but still ... having experience with the insanely overcomplicated Match/Matches/etc./etc./etc./etc. objects of the .Net regular expressions ... this sounds scary. So I asked uncle Google, ended up in per6-regex-intro and ... I did not like what I saw. OK. So the matches are in the object named $/ (OK, so $/ meant something in Perl5, let's change that!) and you can access them as $/[0], $/[1], ... (hey, wasn't we supposed to use @ for arrays. Oh, right, this is an object, you just index it as if it was an array, but ...) ... and there are shortcuts in the form $0, $1, $2, ...

      WHAT?!? Yeah, the sortcuts start with $0! Yeah, what used to be $1 is now $0, what used to be $2 is now $1 etc. Just lovely! Imagine you got yourself into the situation when you have to write Perl6 code while still maintaining Perl5 code. I'd love to have a penny for every full hour lost because of the confusion caused by this change! Even with the number of people using Perl6 now, I'm sure it'd pay a few beers.

      The more I know about Perl6, the more I hope it's gonna disappear almost without a trace as a failed experiment. It uses the name, it looks deceptively similar, yet it is full of changes carefuly designed to cause as much confusion as possible.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        Perl 6 is many things. For one, it includes a language I'll call STD. STD is specifically designed to host other languages including ones I'll call Pure Perl 5 (a new Perl 5 parser) and #p5p perl (Pumpkin Perl). In your comment you explore STD but then reject everything, which means you've thrown the babies (Pure Perl 5 and #p5p perl hosted alongside Pure Perl 5) out with the bathwater.

        Maybe you can reconsider the bathtub so you can at least look forward to using Pure Perl 5 (which supports $/ as input record separator, $0 as the executable name, and so on) running on android or in a browser and supporting parallel processing and so on.

        So the matches are in the object named $/ (OK, so $/ meant something in Perl5, let's change that!)

        If you want $/ as the input separator, use a Perl 5.

        I agree with @Larry (the team who designed the Perl 6 STD language) that constraining the Perl 6 STD language to back compat with Perl 5 syntax and semantics would have been a big mistake and a big missed opportunity. The end result is still much more friendly to the average Perl 5 user than, say, lisp, haskell, or scala.

        you can access them as $/[0], $/1, ... (hey, wasn't we supposed to use @ for arrays. Oh, right, this is an object, you just index it as if it was an array, but ...)

        You can use @ for arrays in the STD language of Perl 6, but you don't have to:

        my $array; $array[3] = True; my @array; @array[3] = True;

        ... and there are shortcuts in the form $0, $1, $2, ... WHAT?!? Yeah, the sortcuts start with $0!

        I agree this sounds particularly disturbing. In practice it doesn't trip folk up. Note that you can do this:

        say "bar" ~~ /$1=(\w)(\w)(\w)/; say $2; # a

        The more I know about Perl6, the more I hope it's gonna disappear almost without a trace as a failed experiment.

        The community is sustainable, vibrant, and growing. The contributor base, family of languages, Rakudo compiler, Rakudo debugger, toolchain, modules, doc, and intrastructure are all maturing nicely. The team has figured out the path to speeding Rakudo up by orders of magnitude. Larry's writing a Camel equivalent. There's still $100k left of the Hague grant. Sorry, but it ain't going away. :)

        Perl 6 is already attracting curious hackers that have never touched Perl 5 and will I predict begin to attract Perl 5 users next year that want to be able to write in a Perl (5ish or 6ish) on new platforms (eg android via the jvm or browsers via javascript), and/or use new capabilities (eg automatic parallelizing) and/or gain expressivity (grammars, lispish macros, etc.). You are free to ignore it but I'm confident it is here to stay and is inevitably going to help usefully address many of the long standing problems Perl 5 has.

      Horray! Keep telling people how good it's gonna be when one of these projects finally gets finished!! Everybody is on the edge of their seats, except I was holding my breath but then I turned blue! So other than Perl-6 causing cyanosis it sounds really good!
        To clarify, all the regex stuff I discussed is already implemented in the Rakudo compiler, modulo bugs.

        I did not intend to comment on whether any of the remaining stuff was going to be any good, just that it was at last happening, which is probably news to many monks.