Perl6-Pugs

 view release on metacpan or  search on metacpan

docs/talks/Apocalypse_Now.spork  view on Meta::CPAN

+* Easier: Common usage patterns dramatically shortened
+* Stronger: Support for OO, Functional, Data-driven styles
+* Leaner: Sane semantics, not endless (documented) workarounds
+* Nicer: Not tied to incomplete unmaintainable XS subsystems
+* DWIMmier: User-defined operators, syntax, grammars....

----
== Without further ado...

{image: http://perlcabal.org/~autrijus/images/cpan.jpg}

* We present: `cpan-upload.p6`!

    use perl5:Net::FTP;
    use perl5:HTTP::Status;
    use perl5:AppConfig::Std;
    use perl5:File::Basename;
    use perl5:LWP::UserAgent;
    use perl5:HTTP::Request::Common;

----
== Assimilating CPAN

{image: http://perlcabal.org/~autrijus/images/borg.jpg}

* The first batch of Perl 5 programs looked like that:

    #!/usr/bin/perl
    require 'open3.pl';
    require 'bigint.pl';
    require 'my_library.pl';

+* I have 100+ CPAN modules
** I don't want to throw them away!
+* Why can't we write our first Perl 6 programs like this?

    #!/usr/bin/pugs
    use perl5:DBI;
    use perl5:WWW::Mechanize;

+* This works in the Pugs interpreter by linking in libperl.
+** What about the other way around -- Perl 6 in Perl 5?

----
== Assimilated by CPAN

{image: http://perlcabal.org/~autrijus/images/borg.jpg}

* `pugs.pm` pragma let you embed Perl 6 code in Perl 5:

    #!/usr/bin/perl
    use pugs;   # Here is some Perl 6 code...
    sub postfix:<!> { [*] 1..$_ }
    sub sum_factorial { [+] 0..$_! }

+    no pugs;    # Here is some Perl 5 code...
    print sum_factorial(3); # 21

+* Implemented with Inline::Pugs and source filter
+* Keeps the Pugs process and shuffle `eval` commands around
+** Extremely fragile; only parses `/^(sub|coro)/`
+** We'd like to fix that so it works reliably
+** More on that in the second half of this talk

----
== Getting started

{image: http://perlcabal.org/~autrijus/images/justdoit.jpg}

* Download Pugs:

    http://pugscode.org/
    http://search.cpan.org/dist/Perl6-Pugs/
    http://linide.sf.net/pugs-livecd-latest.iso
    http://svn.openfoundry.org/pugs/

+* Command line:

    % pugs -e "'Hello, world!'.say"
    Hello, world!

    % pugs examples/japh/ipw-japh.p6
    Just another Perl6 hacker...

+* Interactive mode:

    % pugs
    pugs> { $_ ?? $_ * &?BLOCK( $_ - 1 ) !! 1 }.(10)
    3628800

----
== Pugs the Project

{image: http://perlcabal.org/~autrijus/images/ship.jpg}

    There hammer on the anvil smote,
    There chisel clove, and graver wrote;
    There forged was blade, and bound was hilt;
    The delver mined, the mason built...

                    -- Pugs, Prim.hs

----
== History

{image: http://perlcabal.org/~autrijus/images/justdoit.jpg}

* Started at Feb 1st; almost 5 months old now
+** Exercise of "Types and Programming Languages"
** (I just wanted to understand junctions and MMD)
+** Learned Haskell because Perl 5 closures leak horribly
+* Not a Perl Foundation project
+** Just a prototype, not the production Perl 6 compiler
+** Optimized for fun, not deliverables
+* Minimizing deadlocks
** Optionally link against Perl 5, Parrot, Haskell
+* Keep Perl 6 retargetable

----
== What we have done



( run in 2.050 seconds using v1.01-cache-2.11-cpan-63c85eba8c4 )