http://qs321.pair.com?node_id=1216604


in reply to Re: Why should any one use/learn Perl 6?
in thread Why should any one use/learn Perl 6?

Perlmonks are so... excellent. Thank you (Your Mother & liz) for exposing my ignorance gently. I didn't know we could timtowdi old syntax. How far does it go? I've done some reading but not that Perl 5 code can be dropped into Perl 6.

> sigilless variables (yes, Perl 6 haz them)!

Is that good? I thought barewords were bad practice. It's been pounded into our heads not to use the old global open FILE convention so now we write open my $file. I realize the implementation is problematic but the original logic of uppercase bare filehandles seems sound considering their relation to STDIN and friends. Is Perl6 going back to the future?

> There is nothing at all stopping Perl 5 from success today except a lack of applications;

That could change overnight. There's an absurd amount of raw power in the Perl ecosystem. What if we decided to deploy as much functionality of CPAN as possible into something like http://blogs.perl.org/users/yang_bo/2018/04/a-new-linux-distribution-with-perl-as-its-heart.html? I'm sure it would rock.

> and general inability to compile or deploy directly to mobile.

Why is that? Does TPF need to fund a grant? How hard is it?

github.com/mid1221213/perldroid www.corion.net/talks/perl-on-android/perl-on-android.en.html blog.thireus.com/how-to-install-ios-perl-framework-on-iphone-ipod-touc +h-or-ipad/

> If no one had stepped up

Perl 5 has evolved very nicely thanks to its modular architecture.

> the game and its rules

This place has the best referees :-)

Perl 5 will not go away. Perl 6 won't go away either. They are both the result of a Perl mindset.

I guess it doesn't matter, sorry for the rant https://github.com/niner/Inline-Perl5

Replies are listed 'Best First'.
Re^3: Why should any one use/learn Perl 6?
by liz (Monsignor) on Jun 14, 2018 at 08:20 UTC
    I've done some reading but not that Perl 5 code can be dropped into Perl 6.

    Indeed, you can not. But like the Queen's English vs American English, they look very much alike. With subtle differences. -> became ., . became ~, sigils don't vary, and you must put a comma after the block in a map. But by and large, you can write Perl 5-style in Perl 6, just as you can write C-style in Perl 5. Even moreso if you use P5built-ins, which exports a growing number of functions (currently at 100 or so) that exist in Perl 5, with the same semantics as in Perl 5. Think about things like tie, opendir, pack/unpack, but also things that exist in Perl 6 but have magic attached (such as shift shifting from @_ or @ARGV by default).

    I thought barewords were bad practice.

    Indeed they are, they don't exist in Perl 6. A sigilless variable needs to be defined: it usually indicates an alias. E.g. in a for loop:

    for @foo -> \element { say element }

    Or as a direct alias to a value in a hash:

    my %hash; my \foo = %hash<FOO>; dd %h; # Hash %h = {} foo = 42; dd %h; # Hash %h = {:FOO(42)}

    So, no, those are not barewords like Perl 5 has them. Perl 5 will happily accept say BAR as valid syntax, Perl 6 does not (unless you have defined BAR in that scope).

    $ perl6 -e 'say BAR' ===SORRY!=== Error while compiling -e Undeclared name: BAR used at line 1

    And yes, all of Perl 5 CPAN is available at your fingertips if you have Inline::Perl5 installed. The only thing you need to do, is to add :from<Perl5> to your use statement, so e.g.

    use DBI:from<Perl5>; use DBD::mysql:from<Perl5>; my $dbh = DBI.connect(...); # call DBI->connect(...) under the hood

    It really can't get much simpler than that, I would say, thanks to all the hard work of Stefan Seifert

Re^3: Why should any one use/learn Perl 6?
by Your Mother (Archbishop) on Jun 14, 2018 at 03:45 UTC

    ++ You have a good attitude and that was a kinder reply than I had coming. :P

    I do my best to be a Perl booster but I am much busier today than 10 years ago when I was much more active at it. I don't have any specific recommendations for apps/code today but there are a few areas Perl has fallen behind Java and Python in particular in libraries. Medical systems in particular. Perl was the first through the door and there are still some terrific pieces like UMLS::Similarity but in most other important areas, like HL7 and DICOM, Perl is lacking. It's where I work today and I would love to have a crack at fixing the situation but it's too much work, the standards are wide and generally badly designed, and there are already C/C++ and Java libs to do everything I need.

      I don't know anything about it but what's wrong with the DICOM and HL7 modules on CPAN?

      The nice thing about glue is that it can leverage everything. I love how Perl can inline other languages, and vice versa. If there is a will, and the skill, and some time; there is a way. All the other kids can import pcre and Perl can and should just appropriate wheels it can't or won't reinvent:

      use Python::NumPy; use Python::HL7apy; use Python::Pydicom;
      Seems kinda easy too https://metacpan.org/search?q=python

        I wrote, and lost, a long reply to this. TL;DR: the DICOM and HL7 code available in Perl is either nearly useless toy code (DICOM) or extremely limited in functionality and spec coverage (HL7). I am super glad to see folks putting effort into it though.