O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
It	was	finally	Christmas:	
Perl	6	is	here!	
Wim	Vanderbauwhede
School	of	Compu6ng	Science
University	of	Glasgow
“Language	is	
ideology”
Kress,	Gunther,	et	al.	"Language	as	ideology."	(1982).
A	trip	down	memory	lane
2007
•  Perl6/Pugs	invited	talk	at	POPL	2007	
•  Audrey	Tang	had	created	Pugs,	a	Perl	6	
implementa6on	in	Haskell	
•  Perl	6	wa...
Perl	6meline
Dow	Jones		index,	1985-2015
Context
hZp://www.codeeval.com/
Context	
TIOBE	Index	for	February	2016,	hZp://www.6obe.com/
Popularity	of	programming	languages	–	TIOBE
Context
TIOBE	Index	for	February	2016,	hZp://www.6obe.com/
Popularity	of	programming	languages	–	TIOBE
Perl
Neil	Stephenson,	“Cryptonomicon”,		p480
Perl	5
•  Interpreted	
•  Dynamically	typed	
•  Garbage	collec6on	
•  In	that	sense	very	similar	to	JavaScript,	
Python,	R...
Perl	5
•  Uses	funny	characters	for	typing:	
				$:	scalar	
				@:	array	(list)	
				%:	hash	(dic6onary,	map)	
				&:	subr...
Perl	5
•  But	also:	
•  Lexical	scoping	
•  Higher-order	func6ons	
•  Anonymous	func6ons	
•  Closures
Perl	6
•  Is	a	new	language,	not	backward	
compa6ble	with	Perl	5.	
•  S6ll	mostly	Perl	
•  But	a	modern	language
Compiler	and	VM
Compiler	(Rakudo)
hZps://github.com/rakudo/rakudo
VM	(MoarVM)
•  Meta-object	protocol	based	
•  Precise,	genera6onal,	and	parallel	GC	
•  First-class	code	objects,	closures...
Grammars
Parsing
• 	Perl	6	has	Grammars,	Rules,	Tokens	and	Regexes	as	
part	of	the	language	
• 	Similar	to	classes	but	used	to	orga...
Objects
JavaScript	 Python	
Objects
Perl	6	Objects
Perl	6	Objects
Roles
Perl	6	Objects
• 	Accessors	for	free
• 	Default	constructor
• 	Inheritance	
• 	Roles	(mixins)
• 	Built	on	a	Meta	Object	Pr...
But	wait	…
Perl	6	Objects
Perl	6	Objects
Gradual	typing!
Gradual	typing
• 	By	default	variables	are	dynamically	typed.	
• 	Explicitly	typed	variables	are	sta6cally	typed.	
• 	But	...
Gradual	typing:	subsets
• 	Type	constraint	checked	at	run	6me
Gradual	typing:	type	capture
• 	Defer	the	specifica6on	of	a	type	constraint	to	the	
6me	the	func6on	is	called.		
• 	Allows	...
Gradual	typing:	type	capture
• 	Defer	the	specifica6on	of	a	type	constraint	to	the	
6me	the	func6on	is	called.		
• 	Allows	...
Roles
Roles
• 	Basis	for	the	Perl	6	type	system		
• 	Used	for	composi6on	and	mixins	
• 	In	Perl	6,	the	“funny	characters”	are	sy...
No	more	funny	characters!
• 	Actually,	the	“funny	characters”	are	now	op6onal:
Polymorphic	func6ons
• 	Also	known	as	mul6ple	dispatch
Polymorphic	func6ons
• 	Also	known	as	mul6ple	dispatch
Polymorphic	func6ons
• 	Looks	familiar?
Parametric	roles
• 	Roles	that	take	one	or	more	type	variables
Possibly	Maybe
FuncHonal	
programming
Func6onal	features
• 	Higher-order	func6ons	
• 	Anonymous	func6ons	(lambdas)		
• 	Currying	
• 	Immutable	lists,	lazy	evalu...
Type	capture	revisited
• 	Type	capture	also	works	with	closures	and	lambdas
Lazy	lists
• 	Perl	6	dis6nguishes	between	sequences,	lists	and	
arrays.	
• 	Sequences	are	immutable,	but	are	consumed	
whe...
Seq	and	List
Array
Promises
Concurrency
• 	High-level	
• 	Promises	(futures)	
• 	Channels	
• 	Supplies	
• 	Low-level	
• 	Threads	
• 	Schedulers	
• 	Lo...
Promises
Conclusion
• 
Thank you!
It was finally Christmas: Perl 6 is here!
Próximos SlideShares
Carregando em…5
×

de

It was finally Christmas: Perl 6 is here! Slide 1 It was finally Christmas: Perl 6 is here! Slide 2 It was finally Christmas: Perl 6 is here! Slide 3 It was finally Christmas: Perl 6 is here! Slide 4 It was finally Christmas: Perl 6 is here! Slide 5 It was finally Christmas: Perl 6 is here! Slide 6 It was finally Christmas: Perl 6 is here! Slide 7 It was finally Christmas: Perl 6 is here! Slide 8 It was finally Christmas: Perl 6 is here! Slide 9 It was finally Christmas: Perl 6 is here! Slide 10 It was finally Christmas: Perl 6 is here! Slide 11 It was finally Christmas: Perl 6 is here! Slide 12 It was finally Christmas: Perl 6 is here! Slide 13 It was finally Christmas: Perl 6 is here! Slide 14 It was finally Christmas: Perl 6 is here! Slide 15 It was finally Christmas: Perl 6 is here! Slide 16 It was finally Christmas: Perl 6 is here! Slide 17 It was finally Christmas: Perl 6 is here! Slide 18 It was finally Christmas: Perl 6 is here! Slide 19 It was finally Christmas: Perl 6 is here! Slide 20 It was finally Christmas: Perl 6 is here! Slide 21 It was finally Christmas: Perl 6 is here! Slide 22 It was finally Christmas: Perl 6 is here! Slide 23 It was finally Christmas: Perl 6 is here! Slide 24 It was finally Christmas: Perl 6 is here! Slide 25 It was finally Christmas: Perl 6 is here! Slide 26 It was finally Christmas: Perl 6 is here! Slide 27 It was finally Christmas: Perl 6 is here! Slide 28 It was finally Christmas: Perl 6 is here! Slide 29 It was finally Christmas: Perl 6 is here! Slide 30 It was finally Christmas: Perl 6 is here! Slide 31 It was finally Christmas: Perl 6 is here! Slide 32 It was finally Christmas: Perl 6 is here! Slide 33 It was finally Christmas: Perl 6 is here! Slide 34 It was finally Christmas: Perl 6 is here! Slide 35 It was finally Christmas: Perl 6 is here! Slide 36 It was finally Christmas: Perl 6 is here! Slide 37 It was finally Christmas: Perl 6 is here! Slide 38 It was finally Christmas: Perl 6 is here! Slide 39 It was finally Christmas: Perl 6 is here! Slide 40 It was finally Christmas: Perl 6 is here! Slide 41 It was finally Christmas: Perl 6 is here! Slide 42 It was finally Christmas: Perl 6 is here! Slide 43 It was finally Christmas: Perl 6 is here! Slide 44 It was finally Christmas: Perl 6 is here! Slide 45 It was finally Christmas: Perl 6 is here! Slide 46 It was finally Christmas: Perl 6 is here! Slide 47 It was finally Christmas: Perl 6 is here! Slide 48 It was finally Christmas: Perl 6 is here! Slide 49 It was finally Christmas: Perl 6 is here! Slide 50 It was finally Christmas: Perl 6 is here! Slide 51 It was finally Christmas: Perl 6 is here! Slide 52
Próximos SlideShares
FPGAs as Components in Heterogeneous HPC Systems (paraFPGA 2015 keynote)
Avançar
Transfira para ler offline e ver em ecrã inteiro.

6 gostaram

Compartilhar

Baixar para ler offline

It was finally Christmas: Perl 6 is here!

Baixar para ler offline

In this talk I introduce Perl 6 and some of its exciting new features, especially gradual typing, roles and some functional programming features like lazy lists.
This talk was given at the Scottish Programming Languages Seminar on 24th Feb 2016 at the School of Computing Science of Glasgow University.

Audiolivros relacionados

Gratuito durante 30 dias do Scribd

Ver tudo

It was finally Christmas: Perl 6 is here!

  1. 1. It was finally Christmas: Perl 6 is here! Wim Vanderbauwhede School of Compu6ng Science University of Glasgow
  2. 2. “Language is ideology” Kress, Gunther, et al. "Language as ideology." (1982).
  3. 3. A trip down memory lane
  4. 4. 2007
  5. 5. •  Perl6/Pugs invited talk at POPL 2007 •  Audrey Tang had created Pugs, a Perl 6 implementa6on in Haskell •  Perl 6 was promised for "Christmas” •  And there was some delay …
  6. 6. Perl 6meline Dow Jones index, 1985-2015
  7. 7. Context hZp://www.codeeval.com/
  8. 8. Context TIOBE Index for February 2016, hZp://www.6obe.com/ Popularity of programming languages – TIOBE
  9. 9. Context TIOBE Index for February 2016, hZp://www.6obe.com/ Popularity of programming languages – TIOBE
  10. 10. Perl Neil Stephenson, “Cryptonomicon”, p480
  11. 11. Perl 5 •  Interpreted •  Dynamically typed •  Garbage collec6on •  In that sense very similar to JavaScript, Python, Ruby, …
  12. 12. Perl 5 •  Uses funny characters for typing: $: scalar @: array (list) %: hash (dic6onary, map) &: subrou6ne •  Incorporates a separate language: regular expressions (PCRE)
  13. 13. Perl 5 •  But also: •  Lexical scoping •  Higher-order func6ons •  Anonymous func6ons •  Closures
  14. 14. Perl 6 •  Is a new language, not backward compa6ble with Perl 5. •  S6ll mostly Perl •  But a modern language
  15. 15. Compiler and VM
  16. 16. Compiler (Rakudo) hZps://github.com/rakudo/rakudo
  17. 17. VM (MoarVM) •  Meta-object protocol based •  Precise, genera6onal, and parallel GC •  First-class code objects, closures, … •  Excep6ons •  Con6nua6ons •  Threads, mutexes, … •  JIT compila6on hZps://github.com/MoarVM/MoarVM
  18. 18. Grammars
  19. 19. Parsing •  Perl 6 has Grammars, Rules, Tokens and Regexes as part of the language •  Similar to classes but used to organize parsers •  Rules are lexeme parsers •  Tokens are token parsers •  Regexes are PCREs •  Perl 6 is parsed and executed using a Perl 6-style grammar.
  20. 20. Objects
  21. 21. JavaScript Python Objects
  22. 22. Perl 6 Objects
  23. 23. Perl 6 Objects Roles
  24. 24. Perl 6 Objects •  Accessors for free •  Default constructor •  Inheritance •  Roles (mixins) •  Built on a Meta Object Protocol •  Full introspec6on •  So s6ll nothing special …
  25. 25. But wait …
  26. 26. Perl 6 Objects
  27. 27. Perl 6 Objects
  28. 28. Gradual typing!
  29. 29. Gradual typing •  By default variables are dynamically typed. •  Explicitly typed variables are sta6cally typed. •  But type checks can be deferred to run 6me. •  Underlying theory: hZps://github.com/samth/gradual-typing-bib
  30. 30. Gradual typing: subsets •  Type constraint checked at run 6me
  31. 31. Gradual typing: type capture •  Defer the specifica6on of a type constraint to the 6me the func6on is called. •  Allows to refer to a type both in the signature and the func6on body.
  32. 32. Gradual typing: type capture •  Defer the specifica6on of a type constraint to the 6me the func6on is called. •  Allows to refer to a type both in the signature and the func6on body.
  33. 33. Roles
  34. 34. Roles •  Basis for the Perl 6 type system •  Used for composi6on and mixins •  In Perl 6, the “funny characters” are syntax for a set of predefined roles: @: Posi6onal (array) %: Associa6ve (hash) &: Callable (subrou6ne) •  So …
  35. 35. No more funny characters! •  Actually, the “funny characters” are now op6onal:
  36. 36. Polymorphic func6ons •  Also known as mul6ple dispatch
  37. 37. Polymorphic func6ons •  Also known as mul6ple dispatch
  38. 38. Polymorphic func6ons •  Looks familiar?
  39. 39. Parametric roles •  Roles that take one or more type variables
  40. 40. Possibly Maybe
  41. 41. FuncHonal programming
  42. 42. Func6onal features •  Higher-order func6ons •  Anonymous func6ons (lambdas) •  Currying •  Immutable lists, lazy evalua6on •  Tail call op6miza6on •  Op6onal immutable variables
  43. 43. Type capture revisited •  Type capture also works with closures and lambdas
  44. 44. Lazy lists •  Perl 6 dis6nguishes between sequences, lists and arrays. •  Sequences are immutable, but are consumed when iterated. •  Lists are immutable •  Arrays are mutable •  By defaults Seq, List and Array are lazy, but can be made eager.
  45. 45. Seq and List
  46. 46. Array
  47. 47. Promises
  48. 48. Concurrency •  High-level •  Promises (futures) •  Channels •  Supplies •  Low-level •  Threads •  Schedulers •  Locks
  49. 49. Promises
  50. 50. Conclusion • 
  51. 51. Thank you!
  • BisnisKecantikanWaja

    Nov. 29, 2021
  • SwetaShankhdhar

    Aug. 5, 2021
  • MichaelLewis106

    Apr. 9, 2021
  • TerryMoten2

    Mar. 3, 2021
  • darwinbates

    Aug. 8, 2020
  • ToddJacobucci

    Feb. 4, 2020

In this talk I introduce Perl 6 and some of its exciting new features, especially gradual typing, roles and some functional programming features like lazy lists. This talk was given at the Scottish Programming Languages Seminar on 24th Feb 2016 at the School of Computing Science of Glasgow University.

Vistos

Vistos totais

21.228

No Slideshare

0

De incorporações

0

Número de incorporações

68

Ações

Baixados

49

Compartilhados

0

Comentários

0

Curtir

6

×