Your SlideShare is downloading. ×
0
Pugs
An implementation of

     Perl 6
              Audrey Tang
≝
Pugs...
Pugs...
≝   Perl 6 Compiler
Pugs...
≝   Perl 6 Compiler
≝   Perl 6 Runtime
Pugs...
≝   Perl 6 Compiler
≝   Perl 6 Runtime
≝   Perl 6 Test Suite
✓
Perl 6 Code
Perl 6 Code

✓ 130+ Modules
Perl 6 Code

✓ 130+ Modules
✓ 160+ Examples
Perl 6 Code

✓ 130+ Modules
✓ 160+ Examples
✓ 18,000+ Unit Tests
“Official Perl 6”
“Official Perl 6”
✓ Defined by semantics,
  not by accidents of history
“Official Perl 6”
✓ Defined by semantics,
  not by accidents of history
✓ Compatibility test suite
  (cf. JavaTest/TCK)
Spec   Test


   ✓
Test   Spec


       ✓
⇚
Perl, circa 1995
Perl, circa 1995
• use   5.000;
Perl, circa 1995
• use 5.000;
• require 'fastcwd.pl';
Perl, circa 1995
• use 5.000;
• require 'fastcwd.pl';
• require 'newgetopt.pl';
Perl, circa 1995
• use 5.000;
• require 'fastcwd.pl';
• require 'newgetopt.pl';
• require 'exceptions.pl';
Perl, circa 2005
Perl, circa 2005
• use   v6-alpha;
Perl, circa 2005
• use   v6-alpha;
• use   perl5:DBI;
Perl, circa 2005
• use   v6-alpha;
• use   perl5:DBI;
• use   perl5:Encode <encode decode>;
Perl, circa 2005
• use   v6-alpha;
• use   perl5:DBI;
• use   perl5:Encode <encode decode>;
• use   perl5:Template;
Perl, circa 2005
• use v6-alpha;
• use perl5:DBI;
• use perl5:Encode <encode decode>;
• use perl5:Template;
• # Implementa...
Hybrid Runcore
                  Pugs


           GHC           Perl 5
          Runtime       Runtime


           Pugs....
Hybrid Runcore
                     Pugs
⇚ Perl 5
              GHC           Perl 5
             Runtime       Runtime


...
Hybrid Runcore
                     Pugs
⇚ Perl 5
              GHC           Perl 5
⇚ Haskell    Runtime       Runtime


...
Hybrid Runcore
                         Pugs
⇚ Perl 5
                  GHC           Perl 5
⇚ Haskell        Runtime     ...
⇛
Pugs
Intermediate
Language
Compilation Flow
Backends

          Pugs




 Java
          Haskell   Perl 5
 Script
Backends
JVM?                                         YARV?

                       Pugs

       CLR?                     ...
Perl 5 Backend
                           Tool Support
                           CPAN, PAUSE
                         Per...
Perl 5 Backend
⇛ Augment P5VM                  Tool Support
                                CPAN, PAUSE
                  ...
Perl 5 Backend
⇛ Augment P5VM                     Tool Support
                                   CPAN, PAUSE
            ...
Perl 5 Backend
⇛ Augment P5VM                     Tool Support
                                   CPAN, PAUSE
            ...
JavaScript Backend
JavaScript Backend
⇛ Like GWT, Hop, Links...
JavaScript Backend
⇛ Like GWT, Hop, Links...
⇛ Passes 90% of tests
JavaScript Backend
⇛ Like GWT, Hop, Links...
⇛ Passes 90% of tests
⇛ Slow - Aim for JS2/Tamarin
䷗
6.0
Primitives
    ䷁
6.2
Functions
   ䷗
6.28
Objects
  ䷒
6.283
Grammars
   ䷊
6.2831
Types
  ䷡
6.28318
Macros
   ䷪
6.283185
Self Hosting
     ䷀
2π
Perl 6!
≠
“Frivolous Toy
  interpreter”
(as seen on Slashdot)
“Frivolous
Toy interpreter”
“Frivolous
Toy interpreter”
“Toy interpreter”
“Toy interpreter”
“Toy”
-Ofun
☺
Arrow length
               15500+ commits




               290+ committers




                       Time
Test Driven
Test Driven

☺Bug report ➟ Test
Test Driven

☺Bug report ➟ Test
☺Smoke Server
Test Driven

☺Bug report ➟ Test
☺Smoke Server
☺:todo<unspecced>
Anarchistic
Anarchistic

☺10+ languages
Anarchistic

☺10+ languages
☺30+ sub-projects
Anarchistic

☺10+ languages
☺30+ sub-projects
☺Aggressive recruiting
Patches Welcome !
Patches Welcome !
Commits Welcome!
✆
irc.freenode.net
      #perl6
λ Camels
λ Camels

✆ 200+ People
λ Camels

✆ 200+ People
✆ 20+ Regulars
λ Camels

✆ 200+ People
✆ 20+ Regulars
✆ TimToady++
svnbot6
evalbot6
devbot6
lambdabot
IRC.pugscode.org
Run.pugscode.org
Dev.pugscode.org
Invite.pugscode.org
Smoke.pugscode.org
Spec.pugscode.org
Blog.pugscode.org
Mailing Lists
Mailing Lists

✆ perl6-users
Mailing Lists

✆ perl6-users
✆ perl6-language
Mailing Lists

✆ perl6-users
✆ perl6-language
✆ perl6-compiler
Repositories
Repositories
     http://svn.pugscode.org/pugs/
Repositories
     http://svn.pugscode.org/pugs/

    http://darcs.pugscode.org/pugs/
Repositories
     http://svn.pugscode.org/pugs/

    http://darcs.pugscode.org/pugs/




    SVK
Erdösing
Erdösing




  2006..*
Hackathons
Hackathons
Taipei
Hackathons
Taipei
Vienna
Hackathons
Taipei
Vienna
Toronto
Hackathons
Taipei
Vienna
Toronto
Amsterdam
Hackathons
Taipei
Vienna
Toronto
Amsterdam
Echt
Hackathons
Taipei
Vienna
Toronto
Amsterdam
Echt
Lismore
Hackathons
Taipei
Vienna
Toronto
Amsterdam
Echt
Lismore
Mt. Arbel
Hackathons
Taipei      Vienna2


Vienna
Toronto
Amsterdam
Echt
Lismore
Mt. Arbel
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto
Amsterdam
Echt
Lismore
Mt. Arbel
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam
Echt
Lismore
Mt. Arbel
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam   Chicago
Echt
Lismore
Mt. Arbel
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam   Chicago
Echt        Boston
Lismore
Mt. ...
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam   Chicago
Echt        Boston
Lismore     ...
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam   Chicago
Echt        Boston
Lismore     ...
Hackathons
Taipei      Vienna2


Vienna      Tokyo
Toronto     Redmond
Amsterdam   Chicago
Echt        Boston
Lismore     ...
Perl 6
 Reconciling the
Irreconcilable
             Audrey Tang
ℙ
Practical
∀
Abstractions
  ➥ Sexy
Closures
sub make_counter {
    my $start = shift;
    return sub { ++$start };
}

my $from_ten = make_counter(10);
my $fr...
Staged Evaluation
BEGIN {
    print "Compile-time";
    eval $generated_code;
    print "Still in compiler";
}
print "Norm...
Runtime Typecasting

my $piece = Pawn->new;
bless $piece, Queen;
S
Shorthands
 ➥ Natural
Contexts
# Scalar vs. List context
my $one = <STDIN>; # Read one line
my @all = <STDIN>; # Read all lines

# String vs. Nu...
Tied Variables

tie my %search => 'Tie::Google';
print $search{'Perl Pugs'}[0]{URL};
# http://www.pugscode.org/
Regular Expresisons
# DeCSS
s''$/=2048;while(<>){G=29;R=142;if((@a=unqT="C*",_)[20]&48){D=89;_=unqb24,qT,@
b=map{ord qB8,u...
Best coding
➥ No coding
CPAN
CPAN

11 years
CPAN

11 years
5500+ authors
CPAN

11 years
5500+ authors
11000+ modules
Services
Services
Package Management
Services
Package Management
Rating & Discussion
Services
Package Management
Rating & Discussion
Smoke Testing
Services
Package Management
Rating & Discussion
Smoke Testing
Issue Tracking
Vocabulary
 ≩ Syntax
“The Best thing
happened to Perl”
But...
Perl 5
is not the best thing
      for CPAN
☣
Syntax
Redundancy
    ☣
•   use v5;
•   use v5;
•   sub render {
•   use v5;
•   sub render {
•       my $self = shift;
•   use v5;
•   sub render {
•       my $self = shift;
•       my %opts = (x => 1, y => 1, z => 0, %{$_[0]});
•   use v5;
•   sub render {
•       my $self = shift;
•       my %opts = (x => 1, y => 1, z => 0, %{$_[0]});
•       for ...
•   use v5;
•   sub render {
•       my $self = shift;
•       my %opts = (x => 1, y => 1, z => 0, %{$_[0]});
•       for ...
•   use v5;
•   sub render {
•       my $self = shift;
•       my %opts = (x => 1, y => 1, z => 0, %{$_[0]});
•       for ...
• use   v6-alpha;
• use v6-alpha;
• method render   ($x = 1, $y = 1, $z = 0) {
• use v6-alpha;
• method render ($x = 1, $y   = 1, $z = 0) {
• for @.filter(@.items)       {
• use v6-alpha;
• method render ($x = 1, $y =   1, $z = 0) {
• for @.filter(@.items) {
•         say .draw(:$x, :$y,   :$z...
Jenga
Internals
   ☣
Bug-for-bug
compatibility
     ☣
Best Practice
takes discipline
Best Practice
should be Natural!
2000
RFCs
2001
Parrot
2002
Apocalypses
2003
          Ponie
(late, as in the late Arthur Dent)
2004
Synopses
2005
Pugs
2006
v6-alpha
Reconcile the Irreconcilable
Static Typing
      vs
Dynamic Typing
Types
  ☺
Typing
  ☹
Static
(C++, OCaml...)
Static
(C++, OCaml...)


 Efficient
Static
(C++, OCaml...)


 Efficient
 Robust
Static            Dynamic
(C++, OCaml...)   (Python, Ruby, ...)


 Efficient
 Robust
Static            Dynamic
(C++, OCaml...)   (Python, Ruby, ...)


 Efficient         Productive
 Robust
Static            Dynamic
(C++, OCaml...)   (Python, Ruby, ...)


 Efficient         Productive
 Robust            Flexible
Gradual Typing
 with Annotations
 and Type Inference
• use v5;
• sub f {
• sqrt($_[0]**2 + $_[1]**2);
•}
• my $five = f( 3, 4 );
• use v6-alpha;
• sub f {
• sqrt(@_[0]**2 + @_[1]**2);
•}
• my $five = f( 3, 4 );
•sub f (Num $x,   Num $y) {
• sqrt($x**2      + $y**2);
•}
•my Num $five =   f( 3, 4 );
• subset   Positive of Num where { $_ > 0 }
• subset Positive   of Num where { $_ > 0 }

• sub f (
        Positive $x, Positive $y
        --> Positive where { $_ > ...
• subset Positive    of Num where { $_ > 0 }

• sub f (
          Positive $x, Positive $y
          --> Positive where { ...
• subset Positive   of Num where { $_ > 0 }

• sub f (
        Positive $x, Positive $y
        --> Positive where { $_ > ...
Domain Specific
      vs
General Purpose
DSL
(SQL, Regex, ...)
DSL
(SQL, Regex, ...)


 Concise
DSL
(SQL, Regex, ...)


 Concise
 Expressive
DSL               GPL
(SQL, Regex, ...)   (Lisp, C, ...)


 Concise
 Expressive
DSL                GPL
(SQL, Regex, ...)    (Lisp, C, ...)


 Concise            Versatile
 Expressive
DSL                GPL
(SQL, Regex, ...)    (Lisp, C, ...)


 Concise            Versatile
 Expressive         Reusable
Extensible
Compilation
Macros
Macros

Compile-time evaluation
Macros

Compile-time evaluation
All parts are swappable
Macros

Compile-time evaluation
All parts are swappable
Even the lexer!
• macro circumfix:</* */> ($x)
• is parsed /.*?/
• { '' }
•
• /* This is a C-style comment   */
•
• sub   postfix:<!> ($x) {
•       [*] 1..$x
•}
•
• say   10!; # 3628800
• macro GREETING () {
• # A late-bound macro
• q:code(:COMPILING){ "Hello,    $s" };
•}
• my $s = "world";
• say GREETING;...
Lazy Evaluation
       vs
Eager Evaluation
Lazy
(Haskell, Unix pipes)
Lazy
(Haskell, Unix pipes)


    Modular
Lazy
(Haskell, Unix pipes)


    Modular
    Reasonable
Lazy                Eager
(Haskell, Unix pipes)   (everybody else)


    Modular
    Reasonable
Lazy                Eager
(Haskell, Unix pipes)   (everybody else)


    Modular             Direct
    Reasonable
Lazy                Eager
(Haskell, Unix pipes)   (everybody else)


    Modular             Direct
    Reasonable        ...
Return-type Polymorphism
 with Laziness Annotations
•# "cat"
 for =<> { .say }
•# "cat"
 for =<> { .say }

•# "cat", together with line numbers
 for each(1..*; =<>) {
     say "Line $^num: $^text";
 }
•#   Lists are lazy by default
• # Lists   are lazy by default
• my @fib   := (
• # Lists are lazy   by default
• my @fib := (
• 0, 1,
• # Lists are lazy by default
• my @fib := (
• 0, 1,
• each(@fib; @fib[1..*]).map(&infix:<+>)
  );
• # Lists are lazy by default
• my @fib := (
• 0, 1,
• each(@fib; @fib[1..*]).map(&infix:<+>)
  );
•
  say "The first ten ...
•#   Items are eager values. However...
• # Items are   eager values. However...
• my $ignored   = lazy { 10 ** (10 * 10) };
• # Items are eager values. However...
• my $ignored = lazy { 10 ** (10 * 10) };
• my $unused = lazy { say 1..$ignored };
• # Items are eager values. However...
• my $ignored = lazy { 10 ** (10 * 10) };
• my $unused = lazy { say 1..$ignored };
...
Classes
    vs
Prototypes
Classes
(Java, Smalltalk, ...)
Classes
(Java, Smalltalk, ...)


  Typeful
Classes
(Java, Smalltalk, ...)


  Typeful
  Disciplined
Classes                 Prototypes
(Java, Smalltalk, ...)    (JavaScript, Lua, ...)


  Typeful
  Disciplined
Classes                 Prototypes
(Java, Smalltalk, ...)    (JavaScript, Lua, ...)


  Typeful                   Adaptive...
Classes                 Prototypes
(Java, Smalltalk, ...)    (JavaScript, Lua, ...)


  Typeful                   Adaptive...
Meta-Object
 Protocol
• class   Dog is Mammal does Companion {
• class   Dog is Mammal does Companion {
•
      my $.count where 0..100;
• class Dog is Mammal does Companion   {
•
      my $.count where 0..100;
•
      has $!brain;
• class Dog is Mammal does Companion   {
•
      my $.count where 0..100;
•
      has $!brain;

•     has &.vocalize = &sa...
• class Dog is Mammal does Companion   {
•
      my $.count where 0..100;
•
      has $!brain;

•     has &.vocalize = &sa...
• class Dog is Mammal does Companion     {
•
      my $.count where 0..100;
•
        has $!brain;

•       has &.vocalize...
• my   Dog $fido .= new;
• my   Dog $fido .= new;
•
  $fido.HOW;    # the meta object for Dog
• my Dog $fido   .= new;
•
  $fido.HOW;     # the meta object for Dog
• $fido.WHAT;    # the Dog prototype object
• my Dog $fido   .= new;
•
  $fido.HOW;     # the meta object for Dog
• $fido.WHAT;    # the Dog prototype object
• $fido....
• my Dog $fido .= new;
•
  $fido.HOW;   # the meta object for Dog
• $fido.WHAT; # the Dog prototype object
• $fido.WHICH; ...
• $fido.HOW.add_method(
       'bark',
       method () { $.vocalize('Woof!') }
  );
• $fido.HOW.add_method(
       'bark',
       method () { $.vocalize('Woof!') }
  );

• Dog.can('bark');   $fido.can('bark...
Threads
   vs
Processes
Threads
(Implicit sharing)
Threads
(Implicit sharing)


Intuitive
Threads
(Implicit sharing)


Intuitive
Parallelizable
Threads              Processes
(Implicit sharing)    (Explicit sharing)


Intuitive
Parallelizable
Threads              Processes
(Implicit sharing)    (Explicit sharing)


Intuitive             Deterministic
Parallelizab...
Threads              Processes
(Implicit sharing)    (Explicit sharing)


Intuitive             Deterministic
Parallelizab...
Concurrency
  ☺☺☺
Locking
☹☹☹
•
async {
   $x.withdraw(3);

    $y.deposit(3);
}
•
async {
   $x.withdraw(3);
    ☣ Race Condition ☣
    $y.deposit(3);
}
• async {
      $x.lock;
      $y.lock;
• async   {
        $x.lock;
        $y.lock;
•       $x.withdraw(3);
        $y.deposit(3);
    }
• async   {               • async {
        $x.lock;                $y.lock;
        $y.lock;                $x.lock;
•   ...
☣ Deadlock ☣

• async   {               • async {
        $x.lock;                $y.lock;
        $y.lock;               ...
Software
Transactional
  Memory
•   async {
•     contend {
        # begin transaction
•       $x.withdraw(3);
        $y.deposit(3);
•      } # commit o...
•# Retry with "defer"
 method withdraw ($n) {
    defer if $.balance < $n;
    $.balance -= $n;
 }
•#    Retry with "defer"
    method withdraw ($n) {
       defer if $.balance < $n;
       $.balance -= $n;
    }
•
    # ...
•#    Retry with "defer"
    method withdraw ($n) {
       defer if $.balance < $n;
       $.balance -= $n;
    }
•
    # ...
SIMD
 vs
MIMD
SIMD
(APL, Fortran)
SIMD
(APL, Fortran)


Simple
SIMD
(APL, Fortran)


Simple
Scalable
SIMD             MIMD
(APL, Fortran)   (everybody else)


Simple
Scalable
SIMD             MIMD
(APL, Fortran)   (everybody else)


Simple           Richer types
Scalable
SIMD             MIMD
(APL, Fortran)   (everybody else)


Simple           Richer types
Scalable         Familiar flow
•# Hyper Operator (SSE/GPU friendly)
 [1, 1, 2, 3, 5] »+« [1, 2, 3, 5, 8];
• # Hyper Operator (SSE/GPU friendly)
  [1, 1, 2, 3, 5] »+« [1, 2, 3, 5, 8];
• # === [2, 3, 5, 8, 13]
•# Recursive Visits
 -« [[1, 2], 3];
• # Recursive Visits
  -« [[1, 2], 3];
• # === [[-1, -2], -3]
•# Hyper Methods
 [1, 4, 9, 16]».sqrt;
•# Hyper Methods
 [1, 4, 9, 16]».sqrt;
•# === [1, 2, 3, 4]
•   % time        pugs -e '(1..100000)>>.sqrt'
    real 9.387s
    user 9.219s
•   % time               pugs -e '(1..100000)>>.sqrt'
    real 9.387s
    user 9.219s
•
    % time env GHCRTS=-N2 pugs -e ...
•# Junctions
 sub is_prime (Int $n --> Bool) {
    $n % all(2 .. $n.sqrt+1);
 }
•#    Junctions
    sub is_prime (Int $n --> Bool) {
       $n % all(2 .. $n.sqrt+1);
    }
•
    sub has_twin_prime (Int ...
•#    Junctions
    sub is_prime (Int $n --> Bool) {
       $n % all(2 .. $n.sqrt+1);
    }
•
    sub has_twin_prime (Int ...
•#    Junctions
    sub is_prime (Int $n --> Bool) {
       $n % all(2 .. $n.sqrt+1);
    }
•
    sub has_twin_prime (Int ...
My Language
     vs
Your Language
Perl 6
Perl 6
 Better
Perl 6
 Better
 Better
Perl 6    Others
 Better
 Better
Perl 6    Others
 Better    Better
 Better
Perl 6    Others
 Better    Better
 Better    Better
•use   jsan:DOM;
•use   perl5:DBI;
•use   haskell:Numeric;
•use   your_language:FavouriteModule;
JVM?                                         YARV?

                       Pugs

       CLR?                              ...
✈
When will
Perl 6 be released?
By Christmas!
When Perl 6 arrives,
every day will be like
    Christmas!
        ❆
Thank you!
   ☺
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Pugs: A Perl 6 Implementation
Upcoming SlideShare
Loading in...5
×

Pugs: A Perl 6 Implementation

1,417

Published on

2007 Pugs talk at Google.tw.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,417
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Pugs: A Perl 6 Implementation"

  1. 1. Pugs An implementation of Perl 6 Audrey Tang
  2. 2.
  3. 3. Pugs...
  4. 4. Pugs... ≝ Perl 6 Compiler
  5. 5. Pugs... ≝ Perl 6 Compiler ≝ Perl 6 Runtime
  6. 6. Pugs... ≝ Perl 6 Compiler ≝ Perl 6 Runtime ≝ Perl 6 Test Suite
  7. 7.
  8. 8. Perl 6 Code
  9. 9. Perl 6 Code ✓ 130+ Modules
  10. 10. Perl 6 Code ✓ 130+ Modules ✓ 160+ Examples
  11. 11. Perl 6 Code ✓ 130+ Modules ✓ 160+ Examples ✓ 18,000+ Unit Tests
  12. 12. “Official Perl 6”
  13. 13. “Official Perl 6” ✓ Defined by semantics, not by accidents of history
  14. 14. “Official Perl 6” ✓ Defined by semantics, not by accidents of history ✓ Compatibility test suite (cf. JavaTest/TCK)
  15. 15. Spec Test ✓
  16. 16. Test Spec ✓
  17. 17.
  18. 18. Perl, circa 1995
  19. 19. Perl, circa 1995 • use 5.000;
  20. 20. Perl, circa 1995 • use 5.000; • require 'fastcwd.pl';
  21. 21. Perl, circa 1995 • use 5.000; • require 'fastcwd.pl'; • require 'newgetopt.pl';
  22. 22. Perl, circa 1995 • use 5.000; • require 'fastcwd.pl'; • require 'newgetopt.pl'; • require 'exceptions.pl';
  23. 23. Perl, circa 2005
  24. 24. Perl, circa 2005 • use v6-alpha;
  25. 25. Perl, circa 2005 • use v6-alpha; • use perl5:DBI;
  26. 26. Perl, circa 2005 • use v6-alpha; • use perl5:DBI; • use perl5:Encode <encode decode>;
  27. 27. Perl, circa 2005 • use v6-alpha; • use perl5:DBI; • use perl5:Encode <encode decode>; • use perl5:Template;
  28. 28. Perl, circa 2005 • use v6-alpha; • use perl5:DBI; • use perl5:Encode <encode decode>; • use perl5:Template; • # Implementation of "crypt" eval "crypt()" :lang<perl5>;
  29. 29. Hybrid Runcore Pugs GHC Perl 5 Runtime Runtime Pugs.Eval Pugs::Runtime Pugs.Prim Pugs::Compiler Pugs.Types Pugs::Grammar
  30. 30. Hybrid Runcore Pugs ⇚ Perl 5 GHC Perl 5 Runtime Runtime Pugs.Eval Pugs::Runtime Pugs.Prim Pugs::Compiler Pugs.Types Pugs::Grammar
  31. 31. Hybrid Runcore Pugs ⇚ Perl 5 GHC Perl 5 ⇚ Haskell Runtime Runtime Pugs.Eval Pugs::Runtime Pugs.Prim Pugs::Compiler Pugs.Types Pugs::Grammar
  32. 32. Hybrid Runcore Pugs ⇚ Perl 5 GHC Perl 5 ⇚ Haskell Runtime Runtime ⇚ C (.so/.dll) Pugs.Eval Pugs.Prim Pugs.Types Pugs::Runtime Pugs::Compiler Pugs::Grammar
  33. 33.
  34. 34. Pugs Intermediate Language
  35. 35. Compilation Flow
  36. 36. Backends Pugs Java Haskell Perl 5 Script
  37. 37. Backends JVM? YARV? Pugs CLR? PyPy? Java Haskell Perl 5 Script
  38. 38. Perl 5 Backend Tool Support CPAN, PAUSE Perldoc, Perl::Tidy ... Syntax v6.pm Pugs::Compiler::Perl6 ... Perl 5 Sugar Moose, Moose::Autobox ... Semantics Data::Bind, Class::MOP Pugs::Runtime, Pugs::Compiler::Rule ... Augmentation (XS) Infrastructure PadWalker, Devel::Caller Parse::Yapp autobox, re::override ... Module::Compile ... Core perl
  39. 39. Perl 5 Backend ⇛ Augment P5VM Tool Support CPAN, PAUSE Perldoc, Perl::Tidy ... Syntax v6.pm Pugs::Compiler::Perl6 ... Perl 5 Sugar Moose, Moose::Autobox ... Semantics Data::Bind, Class::MOP Pugs::Runtime, Pugs::Compiler::Rule ... Augmentation (XS) Infrastructure PadWalker, Devel::Caller Parse::Yapp autobox, re::override ... Module::Compile ... Core perl
  40. 40. Perl 5 Backend ⇛ Augment P5VM Tool Support CPAN, PAUSE Perldoc, Perl::Tidy ... Syntax v6.pm Pugs::Compiler::Perl6 ... ⇛ Deploy P6 as P5 Perl 5 Sugar Moose, Moose::Autobox ... Semantics Data::Bind, Class::MOP Pugs::Runtime, Pugs::Compiler::Rule ... Augmentation (XS) Infrastructure PadWalker, Devel::Caller Parse::Yapp autobox, re::override ... Module::Compile ... Core perl
  41. 41. Perl 5 Backend ⇛ Augment P5VM Tool Support CPAN, PAUSE Perldoc, Perl::Tidy ... Syntax v6.pm Pugs::Compiler::Perl6 ... ⇛ Deploy P6 as P5 Perl 5 Sugar Moose, Moose::Autobox ... Semantics Data::Bind, Class::MOP Pugs::Runtime, Pugs::Compiler::Rule ... ⇛ v6.pm on CPAN Augmentation (XS) Infrastructure PadWalker, Devel::Caller Parse::Yapp autobox, re::override ... Module::Compile ... Core perl
  42. 42. JavaScript Backend
  43. 43. JavaScript Backend ⇛ Like GWT, Hop, Links...
  44. 44. JavaScript Backend ⇛ Like GWT, Hop, Links... ⇛ Passes 90% of tests
  45. 45. JavaScript Backend ⇛ Like GWT, Hop, Links... ⇛ Passes 90% of tests ⇛ Slow - Aim for JS2/Tamarin
  46. 46.
  47. 47. 6.0 Primitives ䷁
  48. 48. 6.2 Functions ䷗
  49. 49. 6.28 Objects ䷒
  50. 50. 6.283 Grammars ䷊
  51. 51. 6.2831 Types ䷡
  52. 52. 6.28318 Macros ䷪
  53. 53. 6.283185 Self Hosting ䷀
  54. 54. 2π Perl 6!
  55. 55.
  56. 56. “Frivolous Toy interpreter” (as seen on Slashdot)
  57. 57. “Frivolous Toy interpreter”
  58. 58. “Frivolous Toy interpreter”
  59. 59. “Toy interpreter”
  60. 60. “Toy interpreter”
  61. 61. “Toy”
  62. 62. -Ofun
  63. 63.
  64. 64. Arrow length 15500+ commits 290+ committers Time
  65. 65. Test Driven
  66. 66. Test Driven ☺Bug report ➟ Test
  67. 67. Test Driven ☺Bug report ➟ Test ☺Smoke Server
  68. 68. Test Driven ☺Bug report ➟ Test ☺Smoke Server ☺:todo<unspecced>
  69. 69. Anarchistic
  70. 70. Anarchistic ☺10+ languages
  71. 71. Anarchistic ☺10+ languages ☺30+ sub-projects
  72. 72. Anarchistic ☺10+ languages ☺30+ sub-projects ☺Aggressive recruiting
  73. 73. Patches Welcome !
  74. 74. Patches Welcome !
  75. 75. Commits Welcome!
  76. 76.
  77. 77. irc.freenode.net #perl6
  78. 78. λ Camels
  79. 79. λ Camels ✆ 200+ People
  80. 80. λ Camels ✆ 200+ People ✆ 20+ Regulars
  81. 81. λ Camels ✆ 200+ People ✆ 20+ Regulars ✆ TimToady++
  82. 82. svnbot6
  83. 83. evalbot6
  84. 84. devbot6
  85. 85. lambdabot
  86. 86. IRC.pugscode.org
  87. 87. Run.pugscode.org
  88. 88. Dev.pugscode.org
  89. 89. Invite.pugscode.org
  90. 90. Smoke.pugscode.org
  91. 91. Spec.pugscode.org
  92. 92. Blog.pugscode.org
  93. 93. Mailing Lists
  94. 94. Mailing Lists ✆ perl6-users
  95. 95. Mailing Lists ✆ perl6-users ✆ perl6-language
  96. 96. Mailing Lists ✆ perl6-users ✆ perl6-language ✆ perl6-compiler
  97. 97. Repositories
  98. 98. Repositories http://svn.pugscode.org/pugs/
  99. 99. Repositories http://svn.pugscode.org/pugs/ http://darcs.pugscode.org/pugs/
  100. 100. Repositories http://svn.pugscode.org/pugs/ http://darcs.pugscode.org/pugs/ SVK
  101. 101. Erdösing
  102. 102. Erdösing 2006..*
  103. 103. Hackathons
  104. 104. Hackathons Taipei
  105. 105. Hackathons Taipei Vienna
  106. 106. Hackathons Taipei Vienna Toronto
  107. 107. Hackathons Taipei Vienna Toronto Amsterdam
  108. 108. Hackathons Taipei Vienna Toronto Amsterdam Echt
  109. 109. Hackathons Taipei Vienna Toronto Amsterdam Echt Lismore
  110. 110. Hackathons Taipei Vienna Toronto Amsterdam Echt Lismore Mt. Arbel
  111. 111. Hackathons Taipei Vienna2 Vienna Toronto Amsterdam Echt Lismore Mt. Arbel
  112. 112. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Amsterdam Echt Lismore Mt. Arbel
  113. 113. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Echt Lismore Mt. Arbel
  114. 114. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Chicago Echt Lismore Mt. Arbel
  115. 115. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Chicago Echt Boston Lismore Mt. Arbel
  116. 116. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Chicago Echt Boston Lismore Portland Mt. Arbel
  117. 117. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Chicago Echt Boston Lismore Portland Mt. Arbel Sao Paulo
  118. 118. Hackathons Taipei Vienna2 Vienna Tokyo Toronto Redmond Amsterdam Chicago Echt Boston Lismore Portland Mt. Arbel Sao Paulo Mountain View?
  119. 119. Perl 6 Reconciling the Irreconcilable Audrey Tang
  120. 120.
  121. 121. Practical
  122. 122.
  123. 123. Abstractions ➥ Sexy
  124. 124. Closures sub make_counter { my $start = shift; return sub { ++$start }; } my $from_ten = make_counter(10); my $from_three = make_counter(3); print $from_three->(); # 4 print $from_three->(); # 5 print $from_ten->(); # 11
  125. 125. Staged Evaluation BEGIN { print "Compile-time"; eval $generated_code; print "Still in compiler"; } print "Normal runtime"; eval $more_generated_code;
  126. 126. Runtime Typecasting my $piece = Pawn->new; bless $piece, Queen;
  127. 127. S
  128. 128. Shorthands ➥ Natural
  129. 129. Contexts # Scalar vs. List context my $one = <STDIN>; # Read one line my @all = <STDIN>; # Read all lines # String vs. Numeric context print "Lines: @all" if @all < 10;
  130. 130. Tied Variables tie my %search => 'Tie::Google'; print $search{'Perl Pugs'}[0]{URL}; # http://www.pugscode.org/
  131. 131. Regular Expresisons # DeCSS s''$/=2048;while(<>){G=29;R=142;if((@a=unqT="C*",_)[20]&48){D=89;_=unqb24,qT,@ b=map{ord qB8,unqb8,qT,_^$a[--D]}@INC;s/...$/1$&/;Q=unqV,qb25,_;H=73;O=$b[4]<<9 |256|$b[3];Q=Q>>8^(P=(E=255)&(Q>>12^Q>>4^Q/8^Q))<<17,O=O>>8^(E&(F=(S=O>>14&7^O) ^S*8^S<<6))<<9,_=(map{U=_%16orE^=R^=110&(S=(unqT,"xbntdxbzx14d")[_/16%8]);E ^=(72,@z=(64,72,G^=12*(U-2?0:S&17)),H^=_%64?12:0,@z)[_%8]}(16..271))[_]^((D>>=8 )+=P+(~F&E))for@a[128..$#a]}print+qT,@a}';s/[D-HO-U_]/$$&/g;s/q/pack+/g;eval
  132. 132. Best coding ➥ No coding
  133. 133. CPAN
  134. 134. CPAN 11 years
  135. 135. CPAN 11 years 5500+ authors
  136. 136. CPAN 11 years 5500+ authors 11000+ modules
  137. 137. Services
  138. 138. Services Package Management
  139. 139. Services Package Management Rating & Discussion
  140. 140. Services Package Management Rating & Discussion Smoke Testing
  141. 141. Services Package Management Rating & Discussion Smoke Testing Issue Tracking
  142. 142. Vocabulary ≩ Syntax
  143. 143. “The Best thing happened to Perl”
  144. 144. But...
  145. 145. Perl 5 is not the best thing for CPAN
  146. 146.
  147. 147. Syntax Redundancy ☣
  148. 148. • use v5;
  149. 149. • use v5; • sub render {
  150. 150. • use v5; • sub render { • my $self = shift;
  151. 151. • use v5; • sub render { • my $self = shift; • my %opts = (x => 1, y => 1, z => 0, %{$_[0]});
  152. 152. • use v5; • sub render { • my $self = shift; • my %opts = (x => 1, y => 1, z => 0, %{$_[0]}); • for my $item ( $self->filter(@{ $self->{items} }) ) {
  153. 153. • use v5; • sub render { • my $self = shift; • my %opts = (x => 1, y => 1, z => 0, %{$_[0]}); • for my $item ( $self->filter(@{ $self->{items} }) ) { • print $item->draw({ x => $opts{x}, y => $opts{y}, z => $opts{z}, }), "n";
  154. 154. • use v5; • sub render { • my $self = shift; • my %opts = (x => 1, y => 1, z => 0, %{$_[0]}); • for my $item ( $self->filter(@{ $self->{items} }) ) { • print $item->draw({ x => $opts{x}, y => $opts{y}, z => $opts{z}, }), "n"; • } }
  155. 155. • use v6-alpha;
  156. 156. • use v6-alpha; • method render ($x = 1, $y = 1, $z = 0) {
  157. 157. • use v6-alpha; • method render ($x = 1, $y = 1, $z = 0) { • for @.filter(@.items) {
  158. 158. • use v6-alpha; • method render ($x = 1, $y = 1, $z = 0) { • for @.filter(@.items) { • say .draw(:$x, :$y, :$z); } }
  159. 159. Jenga Internals ☣
  160. 160. Bug-for-bug compatibility ☣
  161. 161. Best Practice takes discipline
  162. 162. Best Practice should be Natural!
  163. 163. 2000 RFCs
  164. 164. 2001 Parrot
  165. 165. 2002 Apocalypses
  166. 166. 2003 Ponie (late, as in the late Arthur Dent)
  167. 167. 2004 Synopses
  168. 168. 2005 Pugs
  169. 169. 2006 v6-alpha
  170. 170. Reconcile the Irreconcilable
  171. 171. Static Typing vs Dynamic Typing
  172. 172. Types ☺
  173. 173. Typing ☹
  174. 174. Static (C++, OCaml...)
  175. 175. Static (C++, OCaml...) Efficient
  176. 176. Static (C++, OCaml...) Efficient Robust
  177. 177. Static Dynamic (C++, OCaml...) (Python, Ruby, ...) Efficient Robust
  178. 178. Static Dynamic (C++, OCaml...) (Python, Ruby, ...) Efficient Productive Robust
  179. 179. Static Dynamic (C++, OCaml...) (Python, Ruby, ...) Efficient Productive Robust Flexible
  180. 180. Gradual Typing with Annotations and Type Inference
  181. 181. • use v5; • sub f { • sqrt($_[0]**2 + $_[1]**2); •} • my $five = f( 3, 4 );
  182. 182. • use v6-alpha; • sub f { • sqrt(@_[0]**2 + @_[1]**2); •} • my $five = f( 3, 4 );
  183. 183. •sub f (Num $x, Num $y) { • sqrt($x**2 + $y**2); •} •my Num $five = f( 3, 4 );
  184. 184. • subset Positive of Num where { $_ > 0 }
  185. 185. • subset Positive of Num where { $_ > 0 } • sub f ( Positive $x, Positive $y --> Positive where { $_ > ($x & $y) } ) {
  186. 186. • subset Positive of Num where { $_ > 0 } • sub f ( Positive $x, Positive $y --> Positive where { $_ > ($x & $y) } ) { • sqrt($x ** 2 + $y ** 2); }
  187. 187. • subset Positive of Num where { $_ > 0 } • sub f ( Positive $x, Positive $y --> Positive where { $_ > ($x & $y) } ) { • sqrt($x ** 2 + $y ** 2); } • my $five := f(3, 4); # inferred as Positive
  188. 188. Domain Specific vs General Purpose
  189. 189. DSL (SQL, Regex, ...)
  190. 190. DSL (SQL, Regex, ...) Concise
  191. 191. DSL (SQL, Regex, ...) Concise Expressive
  192. 192. DSL GPL (SQL, Regex, ...) (Lisp, C, ...) Concise Expressive
  193. 193. DSL GPL (SQL, Regex, ...) (Lisp, C, ...) Concise Versatile Expressive
  194. 194. DSL GPL (SQL, Regex, ...) (Lisp, C, ...) Concise Versatile Expressive Reusable
  195. 195. Extensible Compilation
  196. 196. Macros
  197. 197. Macros Compile-time evaluation
  198. 198. Macros Compile-time evaluation All parts are swappable
  199. 199. Macros Compile-time evaluation All parts are swappable Even the lexer!
  200. 200. • macro circumfix:</* */> ($x) • is parsed /.*?/ • { '' } • • /* This is a C-style comment */ •
  201. 201. • sub postfix:<!> ($x) { • [*] 1..$x •} • • say 10!; # 3628800
  202. 202. • macro GREETING () { • # A late-bound macro • q:code(:COMPILING){ "Hello, $s" }; •} • my $s = "world"; • say GREETING; # Hello, world
  203. 203. Lazy Evaluation vs Eager Evaluation
  204. 204. Lazy (Haskell, Unix pipes)
  205. 205. Lazy (Haskell, Unix pipes) Modular
  206. 206. Lazy (Haskell, Unix pipes) Modular Reasonable
  207. 207. Lazy Eager (Haskell, Unix pipes) (everybody else) Modular Reasonable
  208. 208. Lazy Eager (Haskell, Unix pipes) (everybody else) Modular Direct Reasonable
  209. 209. Lazy Eager (Haskell, Unix pipes) (everybody else) Modular Direct Reasonable Predictable
  210. 210. Return-type Polymorphism with Laziness Annotations
  211. 211. •# "cat" for =<> { .say }
  212. 212. •# "cat" for =<> { .say } •# "cat", together with line numbers for each(1..*; =<>) { say "Line $^num: $^text"; }
  213. 213. •# Lists are lazy by default
  214. 214. • # Lists are lazy by default • my @fib := (
  215. 215. • # Lists are lazy by default • my @fib := ( • 0, 1,
  216. 216. • # Lists are lazy by default • my @fib := ( • 0, 1, • each(@fib; @fib[1..*]).map(&infix:<+>) );
  217. 217. • # Lists are lazy by default • my @fib := ( • 0, 1, • each(@fib; @fib[1..*]).map(&infix:<+>) ); • say "The first ten numbers are: @fib[^10]";
  218. 218. •# Items are eager values. However...
  219. 219. • # Items are eager values. However... • my $ignored = lazy { 10 ** (10 * 10) };
  220. 220. • # Items are eager values. However... • my $ignored = lazy { 10 ** (10 * 10) }; • my $unused = lazy { say 1..$ignored };
  221. 221. • # Items are eager values. However... • my $ignored = lazy { 10 ** (10 * 10) }; • my $unused = lazy { say 1..$ignored }; • say "Hello, world!";
  222. 222. Classes vs Prototypes
  223. 223. Classes (Java, Smalltalk, ...)
  224. 224. Classes (Java, Smalltalk, ...) Typeful
  225. 225. Classes (Java, Smalltalk, ...) Typeful Disciplined
  226. 226. Classes Prototypes (Java, Smalltalk, ...) (JavaScript, Lua, ...) Typeful Disciplined
  227. 227. Classes Prototypes (Java, Smalltalk, ...) (JavaScript, Lua, ...) Typeful Adaptive Disciplined
  228. 228. Classes Prototypes (Java, Smalltalk, ...) (JavaScript, Lua, ...) Typeful Adaptive Disciplined Convenient
  229. 229. Meta-Object Protocol
  230. 230. • class Dog is Mammal does Companion {
  231. 231. • class Dog is Mammal does Companion { • my $.count where 0..100;
  232. 232. • class Dog is Mammal does Companion { • my $.count where 0..100; • has $!brain;
  233. 233. • class Dog is Mammal does Companion { • my $.count where 0..100; • has $!brain; • has &.vocalize = &say; has $.name is rw = "Fido";
  234. 234. • class Dog is Mammal does Companion { • my $.count where 0..100; • has $!brain; • has &.vocalize = &say; has $.name is rw = "Fido"; • has $.fur handles Groomable; has $.tail handles <wag hang>;
  235. 235. • class Dog is Mammal does Companion { • my $.count where 0..100; • has $!brain; • has &.vocalize = &say; has $.name is rw = "Fido"; • has $.fur handles Groomable; has $.tail handles <wag hang>; • method companion handles s/^owner_// { ... } }
  236. 236. • my Dog $fido .= new;
  237. 237. • my Dog $fido .= new; • $fido.HOW; # the meta object for Dog
  238. 238. • my Dog $fido .= new; • $fido.HOW; # the meta object for Dog • $fido.WHAT; # the Dog prototype object
  239. 239. • my Dog $fido .= new; • $fido.HOW; # the meta object for Dog • $fido.WHAT; # the Dog prototype object • $fido.WHICH; # $fido’s Object ID
  240. 240. • my Dog $fido .= new; • $fido.HOW; # the meta object for Dog • $fido.WHAT; # the Dog prototype object • $fido.WHICH; # $fido’s Object ID • Dog.isa(Dog); $fido.isa(Dog);
  241. 241. • $fido.HOW.add_method( 'bark', method () { $.vocalize('Woof!') } );
  242. 242. • $fido.HOW.add_method( 'bark', method () { $.vocalize('Woof!') } ); • Dog.can('bark'); $fido.can('bark');
  243. 243. Threads vs Processes
  244. 244. Threads (Implicit sharing)
  245. 245. Threads (Implicit sharing) Intuitive
  246. 246. Threads (Implicit sharing) Intuitive Parallelizable
  247. 247. Threads Processes (Implicit sharing) (Explicit sharing) Intuitive Parallelizable
  248. 248. Threads Processes (Implicit sharing) (Explicit sharing) Intuitive Deterministic Parallelizable
  249. 249. Threads Processes (Implicit sharing) (Explicit sharing) Intuitive Deterministic Parallelizable Manageable
  250. 250. Concurrency ☺☺☺
  251. 251. Locking ☹☹☹
  252. 252. • async { $x.withdraw(3); $y.deposit(3); }
  253. 253. • async { $x.withdraw(3); ☣ Race Condition ☣ $y.deposit(3); }
  254. 254. • async { $x.lock; $y.lock;
  255. 255. • async { $x.lock; $y.lock; • $x.withdraw(3); $y.deposit(3); }
  256. 256. • async { • async { $x.lock; $y.lock; $y.lock; $x.lock; • $x.withdraw(3); } $y.deposit(3); }
  257. 257. ☣ Deadlock ☣ • async { • async { $x.lock; $y.lock; $y.lock; $x.lock; • $x.withdraw(3); } $y.deposit(3); }
  258. 258. Software Transactional Memory
  259. 259. • async { • contend { # begin transaction • $x.withdraw(3); $y.deposit(3); • } # commit or rollback • }
  260. 260. •# Retry with "defer" method withdraw ($n) { defer if $.balance < $n; $.balance -= $n; }
  261. 261. •# Retry with "defer" method withdraw ($n) { defer if $.balance < $n; $.balance -= $n; } • # Choice with "maybe" sub transfer ($x1, $x2, $y) { maybe { $x1.withdraw(3) } maybe { $x2.withdraw(3) } $y.deposit(3); }
  262. 262. •# Retry with "defer" method withdraw ($n) { defer if $.balance < $n; $.balance -= $n; } • # Choice with "maybe" sub transfer ($x1, $x2, $y) { maybe { $x1.withdraw(3) } maybe { $x2.withdraw(3) } $y.deposit(3); } • # Composable with nested "maybe" contend { maybe { transfer($x1, $x2, $y) } maybe { transfer($x3, $x4, $y) } }
  263. 263. SIMD vs MIMD
  264. 264. SIMD (APL, Fortran)
  265. 265. SIMD (APL, Fortran) Simple
  266. 266. SIMD (APL, Fortran) Simple Scalable
  267. 267. SIMD MIMD (APL, Fortran) (everybody else) Simple Scalable
  268. 268. SIMD MIMD (APL, Fortran) (everybody else) Simple Richer types Scalable
  269. 269. SIMD MIMD (APL, Fortran) (everybody else) Simple Richer types Scalable Familiar flow
  270. 270. •# Hyper Operator (SSE/GPU friendly) [1, 1, 2, 3, 5] »+« [1, 2, 3, 5, 8];
  271. 271. • # Hyper Operator (SSE/GPU friendly) [1, 1, 2, 3, 5] »+« [1, 2, 3, 5, 8]; • # === [2, 3, 5, 8, 13]
  272. 272. •# Recursive Visits -« [[1, 2], 3];
  273. 273. • # Recursive Visits -« [[1, 2], 3]; • # === [[-1, -2], -3]
  274. 274. •# Hyper Methods [1, 4, 9, 16]».sqrt;
  275. 275. •# Hyper Methods [1, 4, 9, 16]».sqrt; •# === [1, 2, 3, 4]
  276. 276. • % time pugs -e '(1..100000)>>.sqrt' real 9.387s user 9.219s
  277. 277. • % time pugs -e '(1..100000)>>.sqrt' real 9.387s user 9.219s • % time env GHCRTS=-N2 pugs -e '(1..100000)>>.sqrt' real 5.807s user 6.959s
  278. 278. •# Junctions sub is_prime (Int $n --> Bool) { $n % all(2 .. $n.sqrt+1); }
  279. 279. •# Junctions sub is_prime (Int $n --> Bool) { $n % all(2 .. $n.sqrt+1); } • sub has_twin_prime (Int $n --> Bool) { is_prime($n & ($n ± 2)); }
  280. 280. •# Junctions sub is_prime (Int $n --> Bool) { $n % all(2 .. $n.sqrt+1); } • sub has_twin_prime (Int $n --> Bool) { is_prime($n & ($n ± 2)); } • sub infix:<±> ($x, $y) { ($x + $y) | ($x - $y); }
  281. 281. •# Junctions sub is_prime (Int $n --> Bool) { $n % all(2 .. $n.sqrt+1); } • sub has_twin_prime (Int $n --> Bool) { is_prime($n & ($n ± 2)); } • sub infix:<±> ($x, $y) { ($x + $y) | ($x - $y); } •
  282. 282. My Language vs Your Language
  283. 283. Perl 6
  284. 284. Perl 6 Better
  285. 285. Perl 6 Better Better
  286. 286. Perl 6 Others Better Better
  287. 287. Perl 6 Others Better Better Better
  288. 288. Perl 6 Others Better Better Better Better
  289. 289. •use jsan:DOM; •use perl5:DBI; •use haskell:Numeric; •use your_language:FavouriteModule;
  290. 290. JVM? YARV? Pugs CLR? PyPy? Java Haskell Perl 5 Script
  291. 291.
  292. 292. When will Perl 6 be released?
  293. 293. By Christmas!
  294. 294. When Perl 6 arrives, every day will be like Christmas! ❆
  295. 295. Thank you! ☺
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×