$30 off During Our Annual Pro Sale. View Details »

DC-Baltimore Perl Workshop - Keynote

DC-Baltimore Perl Workshop - Keynote

This was a keynote given at the first DC-Baltimore Perl workshop. The topic was "Future Perl" and it laid out a number of features I would like to see come about in Perl (some of which actually have).

Stevan Little

April 14, 2012
Tweet

More Decks by Stevan Little

Other Decks in Programming

Transcript

  1. Future Perl
    Stevan Little
    DCBPW 2012
    This talk will explore the recent comeback of Perl core development, review some of the
    mistakes made, and talk about how bright the future can be for Perl.

    View Slide

  2. The whole intent of Perl 5's module system was
    to encourage the growth of Perl culture rather
    than the Perl core.
    – Larry Wall
    Larry said this about Perl 5, sometimes around when he originally released it. The CPAN, and
    the community that created, is the embodiment of that idea.
    Recently (the former) Pumpking, Jesse Vincent, proposed that we actually take this idea one
    step further. He proposed that we actually start removing things from the Perl core and
    putting them into modules.
    While this might seem insane at first, there are a number of changes which have happened in
    the Perl core that actually make this idea quite sane.

    View Slide

  3. 2000
    Perl 5.6 is released
    Jon Orwant smashed a cup and said "We're fucked!" ... a little while later, Perl 6 was
    announced.
    Perl 5.6 was 2 years in the making, but actually had a lot going on.

    View Slide

  4. 2000
    Perl 5.6 is released
    Unicode
    Lexical warnings
    Weak references
    our variables
    3-arg open
    64-bit support
    Large file support

    View Slide

  5. 2000
    Perl 5.6 is released
    Unicode
    Lexical warnings
    Weak references
    our variables
    3-arg open
    64-bit support
    Large file support
    lvalue subroutines
    Subroutine attributes
    Pseudo hash improvements

    View Slide

  6. 2003
    Perl 5.8 is released
    no mentionable new features

    View Slide

  7. 2004
    Steve Yegge "famously" ranted against Perl.
    Perl is Dead! (he said)

    View Slide

  8. 2004
    Many of his points were drunken trolling, but many still were valid.

    View Slide

  9. [RULEZ]
    [RULEZ]
    [PERL]
    [PERL]
    No one told us! (the greater perl community said)

    View Slide

  10. 6
    much of the Perl core work was focused on Perl 6 which was not showing any signs of
    release.

    View Slide

  11. Parrot too was in trouble.
    The Perl 6 language itself was still in flux.
    Meanwhile, other languages were on the rise, Ruby, Python, etc. The fun of a new toy was
    driving lots of work in them.

    View Slide

  12. 2005
    2005, shit gets real!
    Audrey Tang and Pugs sparks a whirlwind of activity

    View Slide

  13. 2005
    Perl 6 spec tests
    Moose & Class::MOP
    Devel::Declare
    Pugs gave birth to a bunch of modules used today and inspired by perl 6

    View Slide

  14. 2005
    Perl 6 spec tests
    Moose & Class::MOP
    Devel::Declare
    Module::Compile
    Data::Bind
    Moose::Autobox
    and more
    And a couple others which ended up not getting as much use, but still inspired work.

    View Slide

  15. Perl 5 was my rewrite of Perl. I want Perl 6 to
    be the community's rewrite of Perl and of the
    community.
    – Larry Wall
    But Pugs did more then contribute code, here is a quote from larry when the Perl 6 project
    really got started. Pugs really got more people involved, it was a good thing.

    View Slide

  16. –Ofun
    And lastly, Pugs brought us the idea of Optimized for Fun. This is an important component of
    what it is to be perlish.

    View Slide

  17. 2007
    But fun wasn’t being had by all ... in 2007, ...

    View Slide

  18. 2007
    Perl 5.10 is released
    Perl 5.10 clawed its way to the surface.
    It had been over 4 years since the last major release.

    View Slide

  19. 2007
    Perl 5.10 is released
    feature pragma
    // (defined-or)
    named captures
    state variables
    say()
    mro pragma
    UNIVERSAL::DOES
    Bunch of okay features, some better then others

    View Slide

  20. 2007
    Perl 5.10 is released
    feature pragma
    // (defined-or)
    named captures
    state variables
    say()
    mro pragma
    UNIVERSAL::DOES
    given/when
    smartmatch
    But also some which were not so successful. Taken from Perl 6 the given/when construct and
    smart matching was implemented, but the results were problematic.
    But then in 2009 ...

    View Slide

  21. 2009
    A New
    (Hope)
    Pumpking
    Jesse Vincent stepped in to be Pumpking. Traditionally pumpkings were the developer/
    releasemanager/etc/etc/etc, Jesse tried a different approach, being basically the project
    manager.

    View Slide

  22. 2010
    Perl 5.12 is released
    And it worked, just 1 year after taking over, he ushered perl 5.12 into existence

    View Slide

  23. 2010
    strict is on by default
    ... (yadda-yadda-yadda)
    each,keys,values for ARRAYs
    Y2038 compliance
    delete local $hash{$entry}
    package NAME VERSION;
    overloading qr//
    Pluggable keywords
    when as statement modifier
    Perl 5.12 is released
    But it wasnt just about features, Jesse also instituted a regular release schedule so that ...

    View Slide

  24. 2011
    strict is on by default
    ... (yadda-yadda-yadda)
    each,keys,values for ARRAYs
    Y2038 compliance
    delete local $hash{$entry}
    package NAME VERSION;
    overloading qr//
    Pluggable keywords
    when as statement modifier
    Perl 5.14 is released
    ARRAY and HASH built-ins on refs
    ${^GLOBAL_PHASE}
    package NAME VERSION {}
    Lots of internals work!
    Perl 5.12 is released
    in 2011 Perl 5.14 was released,

    View Slide

  25. Perl 5.16 and Beyond
    but perhaps jesse’s biggest contribution to Perl was actually a talk he gave last summer in
    which he laid out the future direction.
    See, ever since 2000 no one had really done this, Perl 5 was old, Perl 6 was new, that was the
    direction. But 11 years later, no Perl 6, so Perl 5 needed to be resuccitated.

    View Slide

  26. But then, this past winter Jesse retired as pumpking, and I think this is one of his next most
    important thing he did, he handed the reigns to RJBS, who then ...

    View Slide

  27. 2012
    Perl 5.16 is released
    brought perl 5.16 into existence (well not yet, actually it wont be officially out until the 16th
    (5/16 to be exact))

    View Slide

  28. 2012
    Perl 5.16 is released
    use 5.016;
    __SUB__
    improved eval
    CORE::* references
    new OOP docs
    notice that the feature count is low, this is on purpose.

    View Slide

  29. 2012
    Perl 5.16 is released
    use 5.016;
    __SUB__
    improved eval
    CORE::* references
    new OOP docs
    Devel::CallParser
    smartmatch.pm
    p5-MOP
    List::Gather
    ...
    Additionally in the last few years some work outside the core has been going on. This is in
    keeping with Jesse’s idea that the core should be slimmer and we should put stuff into
    modules.

    View Slide

  30. 2012
    Perl 5.16 is released
    use 5.016;
    before we go further, I want to discuss this one feature ...

    View Slide

  31. 2012
    Perl 5.16 is released
    use 5.016;
    # only 5.16 features enabled here
    use 5.014;
    # only 5.14 features enabled here (not 5.16)
    before we go further, I want to discuss this one feature ...

    View Slide

  32. So, this is present day, but this talk is called Future Perl, so lets take a trip.
    Disclaimer: nothing from here on out is sanctioned. When I floated some of this to RJBS, he
    said “sounds good, just get someone to implement them” :)

    View Slide

  33. Perl 5.18 is released
    2013
    use 5.018;
    try {
    ...
    SomeException->throw;
    } catch {
    when ( $_->isa(‘SomeException’) ) {
    warn “Got Some Exception: “ . $_->message;
    }
    default {
    die $_;
    }
    }
    Okay, so just a year ahead.
    Wouldn’t it be nice to have proper exceptions?
    This code is actually already possible using Try::Tiny and one of the many exception
    modules, but wouldn’t it be nice to have some level of standardization. Now I know this is
    Perl, so TIMTOWTDI, but that has a bad side too. Error handling is a mess in Perl, lets fix it.

    View Slide

  34. Perl 5.18 is released
    2013
    use 5.018;
    fun fib ( $num ) {
    return 0 if $num == 1;
    return 1 if $num == 2;
    return fib( $num - 1 ) + fib( $num - 2 );
    }
    fun ok ( $test, $message=’...’ ) {
    $test ? “ok $message” : “not ok $message”
    }
    fun log ( $level, ?$message ) {
    $message ? print( “[$level] : $message” )
    : print( “[$level]” );
    }
    What about function parameters? They don’t have to be fancy, they shouldn’t introduce types,
    there is (for now) no need for them to be introspectable either. Just simple parameters, that
    can be required, have a default, and be optional.
    I ran this by Jesse Luehrs and he said that doing this with Devel::CallParser “might actually
    just work”

    View Slide

  35. Perl 5.18 is released
    2013
    package Foo {
    use 5.018;
    sub bar {
    baz()
    }
    my sub baz { ... }
    }
    Foo::baz() # BOOM!
    And what about privacy. I know, again, this is perl, stay out cause I asked you, not cause I
    have a shotgun. But have you meet some of the people in the perl community (present
    company included).

    View Slide

  36. Perl 5.20 is released
    2014
    use 5.020;
    class Point {
    has $x = 0;
    has $y = 0;
    method clear { ($x, $y) = (0, 0) }
    }
    class Point3D (extends => Point) {
    has $z = 0;
    method clear {
    super();
    $z = 0;
    }
    }
    So, just 2 years ahead now. This is actually my proposal, to add a new MOP based object
    system to perl. If you want to know more about this, come see me after the talk. And if you
    want to contribute, definitely come see me.

    View Slide

  37. Perl 5.20 is released
    2014
    use 5.020;
    foreach my $elem ($foo{bar}{baz}[2]->@) {
    ...
    }
    while ( my ($k, $v) = each $foo{bar}{baz}->% ) {
    ....
    }
    Now, this is something RJBS talked to me about and at first I was like WTF. Then I really gave
    it some thought and I was like “Hmmm”.
    This is the idea of a post-fix dereference operator, pretty fancy actually!

    View Slide

  38. Perl 5.22 is released
    2015
    use 5.022;
    if ( $id == any( 1, 2, 3 ) ) { ... }
    if ( $value eq none( ‘y’, ‘n’ ) ) { ... }
    if ( all( $foo, $bar ) >= 10 ) { ... }
    if ( one( 0 .. 10 ) == $baz ) { ... }
    So one of the features in Perl 6 that I really feel in love with was junctions. There are a couple
    of good CPAN modules out there, but really this should be something simpler, just a plain
    pragma. Also, it really should be in C so that it can be fast.

    View Slide

  39. Perl 5.22 is released
    2015
    use 5.022;
    fun reduce ( $acc, @list ) {
    match ( @list ) {
    case ($head, @tail) { reduce( $head + $acc, @tail ) }
    case ($head, ()) { $head + $acc }
    }
    }
    How many of you have written OCaml? Haskell?
    Pattern matching is great, and with destructuring bind, it is even more awesome.

    View Slide

  40. Perl 5.22 is released
    2015
    use 5.022;
    fun reduce ( $acc, $head ) { $head + $acc }
    fun reduce ( $acc, $head, @tail ) {
    reduce( $head + $acc, @tail )
    }
    It also can be desugared into a style of multi-methods (see also Standard ML)

    View Slide

  41. Perl 5.22 is released
    2015
    use 5.022;
    fun control ( $connection, $message ) {
    match ( @$message ) {
    case ( 'start', $name, @args ) {
    $connection->get($name)->start( @args );
    }
    case ( 'stop', $name ) {
    $connection->get($name)->stop;
    }
    case ( 'error', $message ) {
    $connection->all->stop;
    warn $message;
    exit;
    }
    }
    }
    and it is not just for recursive esoteria, it can be very useful, think of it as a more awesome-
    er switch.

    View Slide

  42. so lets jump ahead a little further now ...

    View Slide

  43. 802701
    OMG! MORLOCKS!

    View Slide

  44. 802701
    Perl 6 is released!!!
    sorry, had to again...

    View Slide

  45. ok, lets fix this now ...

    View Slide

  46. Perl 5.32 is released
    2025
    % perlc -Ofun --target LLVM my_app.pl
    % perl -MO=JVM foo.pl
    % gcc -Wall bar.pl -o bar
    Part of what drives trendiness in programming languages is actually the level of CS sexy, and
    the idea that they can be pushed forward in new and exicting ways. Of course, this leads to
    disasters too, but until now (the future) it hasn't even really been possible, but thanks now to
    the reduced core, ....
    I have faith that Perl as a language can survive 13 years, it is
    flexible and has proven to be useful in many contexts. But where
    it needs to innovate is the compiler infrastructure.
    IronPython and JRuby are out there, they might not be the best or
    fastest, but they are platforms for innovation. Languages are
    consolidating around central VMs and cross language integration
    and Perl is behind on this.

    View Slide

  47. The End

    View Slide