Top Banner
Pugs Perl 6 on Haskell Audrey Tang 1
289

Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Sep 23, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PugsPerl 6 on Haskell

AudreyTang1

Page 2: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs ≝ ?

2

Page 3: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs...

≝ Perl6Compiler

≝ Perl6Runtime

≝ Perl6TestSuite

3

Page 4: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

4

Page 5: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

5

Page 6: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6

Page 7: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

7

Page 8: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

✓8

Page 9: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Perl6Code

✓ 119Modules

✓ 145Examples

✓ 11,550UnitTests

9

Page 10: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Test⇔Spec

✓10

Page 11: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

⇚11

Page 12: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• use v6-pugs;• use perl5:DBI;• use perl5:Encode;• use perl5:Template;• # ...

Perl5

12

Page 13: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Parrot

Parrot

Tcl Python Scheme

Pugs

13

Page 14: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Haskell

• inline Haskell => q[• fac :: Int -> Int• fac 0 = 1• fac x = x * fac (x - 1)• ];

14

Page 15: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

⇛15

Page 16: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

pugscc

16

Page 17: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PugsIntermediateLanguage

17

Page 18: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PILBackends

⇛ Perl5

⇛ Parrot

⇛ JavaScript

18

Page 19: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

19

Page 20: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

䷗20

Page 21: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.0InitialRelease

21

Page 22: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.2Functions

22

Page 23: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.28Objects

23

Page 24: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.283Grammar

24

Page 25: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.2831TypeSystem

25

Page 26: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.28318Macros

26

Page 27: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

6.283185SelfHosting

27

Page 28: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2πPerl6!☯

28

Page 29: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs ≠...

29

Page 30: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“FrivolousToyinterpreter”(asseenon/.)

30

Page 31: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“FrivolousToyinterpreter”

31

Page 32: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“FrivolousToyinterpreter”

32

Page 33: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“Toyinterpreter”

33

Page 34: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“Toyinterpreter”

34

Page 35: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“Toy”35

Page 36: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

-Ofun36

Page 37: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

☺37

Page 38: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Arrowlength

Time

10000+commits

200+committers

38

Page 39: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

TestDriven

☺Bugreport➟Test

☺SmokeServer

☺:todo<unspecced>

39

Page 40: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Anarchistic

☺20+Sub‐projects

☺10+Languages

☺ConstantReview

40

Page 41: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PatchesWelcome!

41

Page 42: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

CommitsWelcome!

42

Page 43: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

✆43

Page 44: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

irc.freenode.net#perl6

44

Page 45: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

λCamels✆ 100+People✆ 20+Regulars✆ TimToady✆ obra,leo,chip,pmichaud✆ rgs,ko1,why,xerox...

45

Page 46: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

svnbot6

46

Page 47: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

evalbot6

47

Page 48: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

lambdabot

48

Page 49: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

OntheWeb

49

Page 50: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

MailingLists✆ perl6‐language

✆ perl6‐internals

✆ perl6‐compiler

✆ perl6‐users

50

Page 51: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PlanetSix

✆ pugs.blogs.com

✆ perlsoc2006.blogspot.com

✆ Listsummaries

51

Page 52: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

...andallthoseWikis

52

Page 53: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

♜53

Page 54: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

http://svn.openfoundry.org/pugs/

http://perlcabal.org/~audreyt/darcs/pugs/

SVK

Repositories

54

Page 55: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SVK♜ OfflineBranches

♜ IncrementalMerge

♜ Client‐only:Fast!

♜ Perl6Ready

55

Page 56: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

56

Page 57: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

♨57

Page 58: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Hackathon♨ Taipei

♨ Vienna

♨ Toronto

♨ Amsterdam

♨ Echt

♨ Lismore

♨ Mt.Arbel

♨ Vienna2

♨ Tokyo

♨ Redmond

♨ Chicago

♨ Boston

♨ Portland

♨ ...andmore!

58

Page 59: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Erdösing♨ 2006..∞

59

Page 60: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

P ≟ Practical

60

Page 61: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

61

Page 62: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

62

Page 63: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

63

Page 64: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

64

Page 65: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

65

Page 66: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

66

Page 67: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

67

Page 68: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

68

Page 69: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

69

Page 70: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

∀70

Page 71: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Abstractions➥Sexy

71

Page 72: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Closuressubmake_counter{my$start=shift;returnsub{++$start};}my$from_ten=make_counter(10);my$from_three=make_counter(3);print$from_three‐>();#4print$from_three‐>();#5print$from_ten‐>();#11

72

Page 73: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

TieuseTie::Google;tiemy%search=>'Tie::Google','~/.googlekey';

for(@{$search{perl}}){print"*$_‐>{title}‐$_‐>{URL}\n";}

73

Page 74: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Abstractions

∀ bless()

∀ IOLayers

∀ BEGIN{...}

74

Page 75: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ℑ75

Page 76: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Shorthands➥Natural

76

Page 77: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Shorthands

ℑ Regex

ℑ Context

ℑ Topical$_

77

Page 78: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

♡78

Page 79: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nocoding➥bestcoding

79

Page 80: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

80

Page 81: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

♡ 10+years

♡ 5000+authors

♡ 10000+modules

CPAN

81

Page 82: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

♡ PackageManagement

♡ Rating&Discussion

♡ SmokeTesting

♡ IssueTracking

Services

82

Page 83: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Vocabulary≩Syntax

83

Page 84: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“BestthinghappenedtoPerl”

84

Page 85: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

But...

85

Page 86: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Perl5isn'tthebestthing

forCPAN

86

Page 87: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

☣87

Page 88: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SyntaxRedundancy

88

Page 89: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• subrender{• my$self=shift;• my%opts=(x=>1,y=>1,z=>0,@_);• formy$item($self‐>filter(@{$self‐>{_items}})){• print$item‐>draw(• x=>$opts{x},• y=>$opts{y},• z=>$opts{z},• ),"\n";• }• }

89

Page 90: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• methodrender($x=1,$y=1,$z=0){• [email protected](@.items){• say.draw(:$x,:$y,:$z);• }• }•

90

Page 91: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

JengaInternals☣

91

Page 92: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

92

Page 93: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Bug‐for‐bugcompatibility

93

Page 94: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

BestPracticetakesdiscipline

94

Page 95: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

95

Page 96: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

BestPracticeshouldbeNatural!

96

Page 97: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

⑥97

Page 98: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2000RFCs

98

Page 99: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2001Parrot

99

Page 100: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2002Apocalypses

100

Page 101: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2003Ponie

101

Page 102: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2004Synopses

102

Page 103: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

2005Pugs

103

Page 104: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

104

Page 105: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs has been…

105

Page 106: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb1TaPLarrived

asanexercise…

106

Page 107: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb6PrimitiveInterpreter

(1|2)+(3|4)➥(4|5|6)

107

Page 108: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb16ImperativeRuntime

say"Hello,world"

108

Page 109: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

❀109

Page 110: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Mar19PCRERegex

s:P5:g/5/6/;

110

Page 111: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Apr26BEGINblocks

useCGI;111

Page 112: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May8svnbot.p6

r2851|iblech++

112

Page 113: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May5EmbeddedParrot

AddHandlermod_pugs

113

Page 114: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May25Prelude.pm

subsprintf($fmt,*@args)

114

Page 115: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May29EmbeddedPerl5

useperl5:DBI;115

Page 116: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

☀116

Page 117: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jun2evalbot.p6

[#perl6]?eval1+1

117

Page 118: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jun24Perl6→PIL→Parrot

makesmoke‐pir118

Page 119: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jul14PIL→Perl5

makesmoke‐perl5

119

Page 120: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jul17PIL→JavaScript

makesmoke‐js

120

Page 121: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Aug1Self‐hostingObjectModel

classClassisObject;

121

Page 122: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Aug3KontentWiki

useperl5:Template;

122

Page 123: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

☁123

Page 124: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Oct9HaskellCabalSupport

libPugs.a124

Page 125: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nov2ndRuntimeAPISpec

Perl6::ObjectSpace

125

Page 126: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nov3ConcurrencySpec

subfisthrottled(:limit(3)){…}

126

Page 127: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nov4PackagingSpec

p5‐Foo‐1.0‐cpan+KANE.jib

127

Page 128: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nov7Coroutines

coro{yield}

128

Page 129: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nov231stcommitfromLarry(stillwaitingforGuido☺)

129

Page 130: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

❅130

Page 131: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Dec20LexicalImport

{useModule;…}

131

Page 132: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jan6YAMLSerialization

say$x.yaml;132

Page 133: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Jan16Pugs/ParrotRuns!

parrotIsBrokenXXX=False

133

Page 134: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb3Self‐parsingGrammar

grammarGrammar;134

Page 135: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb14RulesengineinPerl5

Pugs::Compiler::Rule

135

Page 136: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb22LarryJoins#perl6

<fglock>TimToady:welcome<Juerd>Justtrytonotgetaddicted:)<TimToady>Juerd:toolate…

136

Page 137: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb24Perl6::DocTreeOverview/Tutorial

FAQ/Perl5/Spec/API

137

Page 138: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Feb25CodeDOM

$ast=q:code/say"hi"/;

138

Page 139: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

❀139

Page 140: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Mar11Perl5Runtimeusev6‐pugs;

140

Page 141: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Mar15DocDOMSpec

=insertCopyright.kwid

141

Page 142: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Mar16BootstrappedonPerl5

lrep.p6lrep.p6

142

Page 143: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Apr1CallingConventionSpec

$tree=\($obj:attr=>1,$child);

143

Page 144: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Apr3UnicodeSpec

=encodingBig5

144

Page 145: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Apr21MITLicense

145

Page 146: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May8PredictiveParsing

<TimToady>"do,ordonot.thereisnotry..."

146

Page 147: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

May20HsSyck+ByteString

“makesmoke”➥14minutes

147

Page 148: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

☼148

Page 149: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

June1SummerofCode

149

Page 150: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SoC:Perl.org

☼ CompletePerl5ParserandPerl6Output

☼ Perl6DBIModule

☼ PugsSelf‐hostingBootstrapFromPerl5andRules

☼ SoftwareTransactionalMemoryforParrot

150

Page 151: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SoC:Haskell.org

☼ FastMutableCollectionTypesforHaskell

☼ UnicodeByteString,Data.Rope,GenericParsec

151

Page 152: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

June4SoftwareTransactionalMemory

atomically{...}

152

Page 153: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

June6ImportfromEmbeddedPerl5

useperl5:Digest::MD5<md5_hex>;

153

Page 154: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

TodayPugs6.2.12

154

Page 155: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Targeting⬇

155

Page 156: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ParrotRoadmap

Parrot

Tcl Python Scheme

156

Page 157: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ParrotRoadmap

Parrot

Tcl Python Scheme

Perl 5(Ponie)

Perl 6

157

Page 158: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PugsRoadmap

Pugs

JavaScript

Haskell Perl 5

158

Page 159: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs

JavaScript

Haskell Perl 5

YARV?JVM?

CLR? PyPy?

PugsRoadmap

159

Page 160: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

يژ160

Page 161: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PopularObjectLanguage

161

Page 162: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

GeneratingJSژ Java:GoogleWebToolkit

ژ Perl:Jifty

ژ Ruby:Rails/JS

ژ Python:Pyjamas

ژ C#:Script#

162

Page 163: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Samelanguageforbothsides

✓163

Page 164: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Client‐sidejustatinysubset

✗164

Page 165: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

CompilingtoJS

ژ HOP/Scheme2JS

ژ Links

ژ HaXe

ژ Pugs!

165

Page 166: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PIL2JS

166

Page 167: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

pugs‐BJS

• WritteninPerl5

• Passes90%oftests

• ~30kRuntime

167

Page 168: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

PIL2JSRuntime

• Primitives&Autoboxing

• Meta‐objectprotocol

• SupportsJSANlibraries

168

Page 169: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

JSAN

• "CPAN".replace(/CP/,"JS")

• ModulesystemwithPrototype.js

• Test.Simple,Jemplate,etc.

169

Page 170: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Shortcomings

• Callingconventiontoocomplex

• CPSrunloopisslow

• Notailrecursionnorgoto

• Butthere'shope!

170

Page 171: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

JS2.0

• Selfhosting

• BacktranslatetoJS1

• Types,Modules,Continuations

• PartofFirefox3.0(nextyear)

171

Page 172: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Migration⇪

172

Page 173: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“CPANisthelanguagePerlisjustsyntax”

173

Page 174: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

174

Page 175: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Stack?

175

Page 176: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Glue!

176

Page 177: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

YAML

• TaggedGraphs

• PerfectforASTs

• Syck:CbindingsfromRuby

177

Page 178: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Inline.pm

• Reuseotherlanguage'slibraries

• SpiderMonkeyallowsJSAN+DBI

• ...butnotforProduction

178

Page 179: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Production

• Existingcode

• NoGHC/SpiderMonkey/Parrot

• NoRewrite‐from‐scratch

• RunningonPerl5VM

179

Page 180: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Perl5VM

• Activelydeveloped

• Widelydeployed

• JustneedaPerl6runtime

180

Page 181: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Moose♘

181

Page 182: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ObjectsWithClass

182

Page 183: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• classPoint;• • • has$.xisrw;#instanceattributes• has$.y;#default"isreadonly"• • methodclear(){• • • $.x=0;#accessiblewithintheclass• $.y=0;• }•

183

Page 184: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• packagePoint;• useMoose;• • hasx=>(is=>'rw');• hasy=>(is=>'ro');• • subclear{• my$self=shift;• • $self‐>{x}=0;• $self‐>y(0);• }•

184

Page 185: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Subclassing

185

Page 186: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• classPoint3D;• • • isPoint;• • has$.z;• • methodclear(){• • call;• $.z=0;• };•

186

Page 187: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• packagePoint3D;• useMoose;• • extends'Point';• • hasz=>(isa=>'Int');• • overrideclear=>sub{• my$self=shift;• super;• $self‐>{z}=0;• };•

187

Page 188: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• packagePoint3D;• useMoose;• • extends'Point';• • hasz=>(isa=>'Int');• • afterclear=>sub{• my$self=shift;• • $self‐>{z}=0;• };•

188

Page 189: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Subtypes

189

Page 190: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• classAddress;• useperl5:Locale::US;• useperl5:Regexp::Common<zip$RE>;• • my$STATES=Locale::US.new;• subsetUS_StateofStrwhere{• $STATES{any(<code2statestate2code>)}{.uc};• };• • hasUS_State$.stateisrw;• hasStr$.zip_codeisrwwhere{• $_~~$RE<zip><<US>{'‐extended'=>'allow'}• };•

190

Page 191: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• packageAddress;• useMoose;• useMoose::Util::TypeConstraints;• useLocale::US;• useRegexp::Common'zip';• • my$STATES=Locale::US‐>new;• subtypeUSState=>asStr=>where{• $STATES‐>{code2state}{uc($_)}• or$STATES‐>{state2code}{uc($_)};• }• • hasstate=>(is=>'rw',isa=>'USState');• haszip_code=>(• is=>'rw',• isa=>subtypeStr=>where{• /$RE{zip}{US}{‐extended=>'allow'}/• },• );•

191

Page 192: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Laziness

192

Page 193: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• classBinaryTreeisrw;• • hasAny$.node;• hasBinaryTree$.parenthandles{• parent_node=>'node'• };• hasBinaryTree$.left={• lazy{BinaryTree.new(parent=>self)}• };• hasBinaryTree$.right={• lazy{BinaryTree.new(parent=>self)}• };•

193

Page 194: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• packageBinaryTree;• useMoose;• • hasnode=>(is=>'rw',isa=>'Any');• hasparent=>(• is=>'rw',• isa=>'BinaryTree',• handles=>{parent_node=>'node'},• weak_ref=>1,• );• hasleft=>(• is=>'rw',• isa=>'BinaryTree',• default=>sub{BinaryTree‐>new(parent=>$_[0])},• lazy=>1,• );

• #dittofor“hasright”

194

Page 195: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•Roles

•Coercion

•Metaclasses

Morefeatures

195

Page 196: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Pugs::Compiler::Rule╬

196

Page 197: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

RegexObjects

197

Page 198: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;

• my$txt='Car=ModelT,1909';• my$pat=rx{• Car‐• [(Ferrari)• |(ModelT,(\d\d\d\d))• ]• };• $txt~~$paterrfail"Cannotmatch";•

198

Page 199: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• usePugs::Compiler::Regex;• my$txt='Car=ModelT,1909';• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car‐• [(Ferrari)• |(ModelT,(\d\d\d\d))• ]• ));• $pat‐>match($txt)ordie"Cannotmatch";•

199

Page 200: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

MatchObjects

200

Page 201: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;

• my$pat=rx{• Car=[• (Ferrari)|(ModelT,(\d\d\d\d))• ]• };• • my$match=('Car=ModelT,1909'~~$pat);• say$match;#"Car=ModelT,1909"• say$match[0];#undef• say$match[1];#"ModelT,1909"• say$match[1][1];#"1909"• say$match[1][1].from;#11• say$match[1][1].to;#15•

201

Page 202: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• usePugs::Compiler::Regex;• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car=[• (Ferrari)|(ModelT,(\d\d\d\d))• ]• ));• usefeatureqw(say);• my$match=$pat‐>match('Car=ModelT,1909');• say$match;#"Car=ModelT,1909"• say$match‐>[0];#undef• say$match‐>[1];#"ModelT,1909"• say$match‐>[1][1];#"1909"• say$match‐>[1][1]‐>from;#11• say$match‐>[1][1]‐>to;#15•

202

Page 203: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

NamedCaptures

203

Page 204: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• • my$pat=rx{• Car=[• (Ferrari)• |(ModelT,$<year>:=[\d\d\d\d])• ]• };

• my$match=('Car=ModelT,1909'~~$pat);• say$match;#"Car=ModelT,1909"• say$match[1];#"ModelT,1909"• say$match[1]<year>;#"1909"• say$match[1]<year>.from;#11• say$match[1]<year>.to;#15•

204

Page 205: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• usePugs::Compiler::Regex;• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car=[• (Ferrari)• |(ModelT,$<year>:=[\d\d\d\d])• ]• ));• usefeatureqw(say);• my$match=$pat‐>match('Car=ModelT,1909');• say$match;#"Car=ModelT,1909"• say$match‐>[1];#"ModelT,1909"• say$match‐>[1]{year};#"1909"• say$match‐>[1]{year}‐>from;#11• say$match‐>[1]{year}‐>to;#15•

205

Page 206: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

GrammarModules

206

Page 207: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• • grammarCarInfo;• • regexcar{• Car=[(Ferrari)|(ModelT,<year>)]• }• regexyear{• \d\d\d\d• }• • moduleMain;• my$match=('Car=ModelT,1909'~~CarInfo.car);•

207

Page 208: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• usePugs::Compiler::Regex;• packageCarInfo;• usebase'Pugs::Grammar::Base';• *car=Pugs::Compiler::Regex‐>compile(q(• Car=[(Ferrari)|(ModelT,<year>)]• ))‐>code;• *year=Pugs::Compiler::Regex‐>compile(q(• \d\d\d\d• ))‐>code;• • packagemain;• my$match=CarInfo‐>car('Car=ModelT,1909');•

208

Page 209: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ResultObjects

209

Page 210: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• #TypicalPerl5code• usev5;• my$txt='Car=ModelT,1909';• my$pat=qr{• Car=(?:(Ferrari)|(ModelT,(\d\d\d\d)))• }x;• my$obj;• if($txt=~$pat){• if($1){• $obj=Car‐>new(color=>"red");• }elsif($2){• $obj=Car‐>new(color=>"black",year=>$3);• }• }•

210

Page 211: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;

• my$txt='Car=ModelT,1909';• my$pat=rx{• Car=[Ferrari• {returnCar.new(:color<red>)}• |ModelT,$<year>:=[\d\d\d\d]• {returnCar.new(:color<black>:$<year>)}• ]• };

• my$obj=$($txt~~$pat);• print$obj<year>;#1909

211

Page 212: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• usePugs::Compiler::Regex;• my$txt='Car=ModelT,1909';• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car=[Ferrari• {returnCar‐>new(color=>'red')}• |ModelT,$<year>:=[\d\d\d\d]• {returnCar‐>new(• color=>'black',year=>$<year>)}• ]• ));• my$obj=$pat‐>match($txt)‐>();• print$obj‐>{year};#1909

212

Page 213: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Module::Compile§

213

Page 214: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SourceFilter

214

Page 215: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• useFilter::Simplesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }•

215

Page 216: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•Addsdependency

•Slowsdownstartup

•Breaksperl‐d

•WrecksotherSourceFilters

Filter::SimpleBad

216

Page 217: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Wecanfixit!

217

Page 218: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• useFilter::Simplesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }

218

Page 219: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev5;• useFilter::Simple::Compilesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }

219

Page 220: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Howdoesitwork?

220

Page 221: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Little‐knownfact:

221

Page 222: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

“useFoo”looksforFoo.pmcbeforeFoo.pm

222

Page 223: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• %echo'print"Hello\n"'>Foo.pmc• %perl‐MFoo‐e1• Hello

223

Page 224: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Savefilteredresultto.pmc...

224

Page 225: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

...nofilteringneedednexttime!

225

Page 226: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•Freeofuser‐sidedependencies

•Faststartuptime

•Debuggablesourceisallin.pmc

•Allowscomposableprecompilers

Module::CompileGood

226

Page 227: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Filter::Simple::Compile

227

Page 228: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• #Drop‐inreplacementtoFilter::Simple• packageAcme::Y2K;• useFilter::Simple::Compilesub{• tr/y/k/;• }•

228

Page 229: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• #It'slexical!• {• useAcme::Y2K;• pacyageFoo;• mydir"tmp";• }• my$normal_code_here;•

229

Page 230: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Filter::Macro

230

Page 231: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• packageMyHandyModules;• useFilter::Macro;• #linesbelowwillbeexpandedintocaller'scode• usestrict;• usewarnings;• useFatalqw(openclose);• useFindBinqw($Bin);•

231

Page 232: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• #Inyourcode• packageMyApp;• useMyHandyModules;• print"I'minvokedfrom$Bin";•

232

Page 233: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Nodependencyon

MyHandyModules.pm

233

Page 234: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

WhataboutDeployingPerl6?

234

Page 235: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

v6.pm⚅

235

Page 236: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Source:Rule.pm

236

Page 237: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• usev6‐pugs;• • grammarPugs::Grammar::Rule;• rulews:P5{• ^((?:\s|\#(?‐s:.)*)+)• }• #...morerules...

237

Page 238: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Target:Rule.pmc

238

Page 239: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• #Generatedfile‐donotedit!• ##################(((32‐bitChecksumValidator)))##################• BEGIN{use5.006;local(*F,$/);($F=__FILE__)=~s!c$!!;open(F)• ordie"Cannotopen$F:$!";binmode(F,':crlf');unpack('%32N*',<F>)• ==0x1D6399E1ordie"Checksumfailedforoutdated.pmcfile:${F}c"}• #####################################################################• packagePugs::Grammar::Rule;• usebase'Pugs::Grammar::Base';• *{'Pugs::Grammar::Rule::ws'}=sub{• my$grammar=shift;• #warn"ruleargumentisundefined"unlessdefined$_[0];• $_[0]=""unlessdefined$_[0];• my$bool=$_[0]=~/^((?:\s|\#(?‐s:.)*)+)(.*)$/sx;• return{• bool=>$bool,• match=>$1,• tail=>$2,• #capture=>$1,• }• };• #...morerules...

239

Page 240: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

WritePerl6compiletoPerl5

⇪240

Page 241: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Eclecticism☯

241

Page 242: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Types☺

242

Page 243: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Typing☹

243

Page 244: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Staticvs

Dynamic244

Page 245: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•usev5;•subf{•sqrt($_[0]**2+$_[1]**2)•}•my$five=f(3,4);

245

Page 246: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•usev6‐pugs;•subf{•sqrt(@_[0]**2+@_[1]**2)•}•my$five=f(3,4);

246

Page 247: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

OptionalAnnotations

247

Page 248: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• subf(Num$x,Num$y){• sqrt($x**2+$y**2);• }• myNum$five=f(3,4);

248

Page 249: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

HybridTypeChecking

249

Page 250: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• subsetPositiveofNumwhere{$_>0}

• subf(• Positive$x,Positive$y• ‐‐>Positivewhere{$_>=($x&$y)}• ){• sqrt($x**2+$y**2);• }

• my$five:=f(3,4);#inferredasPositive

250

Page 251: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Compilervs

Runtime251

Page 252: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

BEGINBlock

• CompilerisaREPL

• Everythingisswappable

• Atendofcompilation,savetheobjectspace

252

Page 253: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ExtensibleGrammar

253

Page 254: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• subpostfix:<!>($x){• [*]1..$x• }• • say10!;#3628800

254

Page 255: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

SyntacticMacros

255

Page 256: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• macrocircumfix:</**/>($x)• isparsed/.*?/• {''}• • /*ThisisaC‐stylecomment*/

256

Page 257: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Caller‐siteMacros

257

Page 258: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• macrohi(){• q:code(:COMPILING))• {"Hello,$s"}• }• my$s="world";• sayhi;#Hello,world

258

Page 259: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Eagervs

Lazy259

Page 260: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ImplicitGenerators

260

Page 261: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• my@fib:=(• 0,1,• each(@fib;@fib[1..*])• .map(&infix:<+>)• );

261

Page 262: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ExplicitAnnotations

262

Page 263: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• my$ignored=lazy{9**9**9}• my$unused=lazy{say[1..$ignored]}• print"Hello,world!"

263

Page 264: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Classesvs

Prototypes264

Page 265: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

MetaObjects

265

Page 266: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• classDogisMammaldoesPet{• my$countwhere0..100;• has$!brain;• has$nameisrw="fido";• has$furhandlesGroomable;• has$tailhandles<waghang>;• has&vocalize=&say;• methodowner()handless/^owner_//{...}• }

266

Page 267: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

• myDog$fido.=new;• #Dog.isa(Dog);$fido.isa(Dog);• • $fido.meta.add_method(• 'bark',• method(){$.vocalize('Woof!')}• );• #Dog.can('bark');$fido.can('bark');

267

Page 268: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

My Languagevs

Your Language268

Page 269: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

•usejsan:DOM;•useperl5:DBI;•useparrot:PGE;•usehaskell:Prelude;

269

Page 270: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

use Haskell;λ

270

Page 271: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

WhyHaskell?

• CodeasSpec

• ExplicitEffects

• Zerorefactoringcost

271

Page 273: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

"Forceyoutoknowwhatyouaredoing."

273

Page 274: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

import Perl◉

274

Page 275: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

"Bestwhenyoudon'tknowwhatyouaredoing."

275

Page 276: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

DWIM

276

Page 277: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

FastMutableCollection

277

Page 278: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

UnicodeLayerOnByteStrings

278

Page 279: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

RopeStrings

279

Page 280: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

DynamicEval

280

Page 281: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

What’s Next?✈

281

Page 282: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

282

Page 283: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

UpcomingHackathons

283

Page 284: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

YAPC::NAHackathon• “LearningPerl6”

• SpeedupPerl5runtime

• Parrotcallingconvention

• StandardizeMooseMOP

284

Page 285: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

BostonHackathon

• Perl6portingexercise

• IntegrateHsJudy

• BenchmarkingRuntimes

285

Page 286: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

WhenwillPerl6bereleased?

286

Page 287: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

ByChristmas!

287

Page 288: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

WhenPerl6isout,everydaywillbelike

Christmas!❆

288

Page 289: Pugs · Pugs Self‐hosting Bootstrap From Perl 5 and Rules Software Transactional Memory for Parrot 150 SoC: Haskell.org Fast Mutable Collection Types for Haskell Unicode ByteString,

Fin.

289