SlideShare a Scribd company logo
1
Turing-complete templates
for everyone!
YAPC::EU 2014 София
Sophia.pm
2
Sophia.pm
3
Templating in Perl
Template-Toolkit
Template::Alloy
Text::Xslate
HTML::Template
many others
4
[% FOREACH page IN pages %]
* [% page.title %]
[% END %]
[% RAWPERL %]
$ouput .=
too_hard_just_call_perl();
[% END %]
5
Idealism
●
hacks
●
quirks
●
kludges
●
This is 2014
Turing completeness is a requirement.
●
Must be a core part of the design
6
Design purity
< > [ ]
+ - , .
Urban Müller, 1993
7
Show me the code
8
Basic templates
Straight text
Straight text
9
Iteration
+++[
* repeated three times
-]
* repeated three times
* repeated three times
* repeated three times
10
Full-fledged character generation
++++++++++[>+++++++>++++++++++>+++>+++++++++<<<<-]
>++.>+.+++++++..+++.>++.>---.<<.+++.------.--------.>+.
Hello World!
11
Positional parameters
,>+++[<{.}>-]
'Badger'
{Badger}{Badger}{Badger}
12
Basic string manipulation
,[=.]=
'Iterating on a string'
=I=t=e=r=a=t=i=n=g= =o=n= =a= =s=t=r=i=n=g=
13
Native arrays
,[.]
[qw(Iterating on an array)]
Iteratingonanarray
14
Advanced string manipulation
,[[>>++++[>++++++++<-]<+<-[>+>+>-
[>>>]<[[>+<-]>>+>]<<<<<-]]>>>[-]+>--[-[<->+++
[-]]]<[++++++++++++<[>-[>+>>]>[+
[<+>-]>+>>]<<<<<-]>>[<+>-]>[-[-<<[-]>>]<<[<<-
>>-]>>]<<[<<+>>-]]<[-]<.[-]<-]
Decrypting a military-grade cipher
'Qrpelcgvat n zvyvgnel-tenqr pvcure'
15
Closing words
●
it works
●
use it
●
not on CPAN (yet)
●
questions?
16
Credits
http://stackoverflow.com/q/14236318/12274
http://www.template-toolkit.org/docs/tutorial/Web.html
http://www.reddit.com/r/tinycode/comments/1oqgwm/short
https://en.wikipedia.org/wiki/Brainfuck#ROT13
http://codegolf.stackexchange.com/a/933/199
https://github.com/jmazon/Acme-Template-TuringComplete

More Related Content

ODP
The Dark Side of Programming Languages
ODP
Untitled talk at Riviera.rb
PDF
Quines—Programming your way back to where you were
PDF
Purely Functional Data Structures
ODP
A Toda Maquina Con Ruby on Rails
PDF
Arulalan Ruby An Intro
PDF
Ruby An Introduction
PPT
270 1 c_intro_up_to_functions
The Dark Side of Programming Languages
Untitled talk at Riviera.rb
Quines—Programming your way back to where you were
Purely Functional Data Structures
A Toda Maquina Con Ruby on Rails
Arulalan Ruby An Intro
Ruby An Introduction
270 1 c_intro_up_to_functions

Similar to Turing-complete templates for everyone! (20)

PPT
270_1_CIntro_Up_To_Functions.ppt
PPT
270_1_CIntro_Up_To_Functions.ppt
PPT
Survey of programming language getting started in C
PPT
CIntro_Up_To_Functions.ppt;uoooooooooooooooooooo
PPT
270_1_CIntro_Up_To_Functions.ppt 0478 computer
PPT
270_1_ChapterIntro_Up_To_Functions (1).ppt
PDF
Happy Coding with Ruby on Rails
KEY
Javascript done right - Open Web Camp III
PPTX
Introduction To PHP000000000000000000000000000000.pptx
PDF
The Ring programming language version 1.5.1 book - Part 10 of 180
PPSX
Symfony2 meets propel 1.5
PDF
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
PDF
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
PPT
Function in cpu 1
PPT
Windows Server 2008 (PowerShell Scripting Uygulamaları)
PDF
Code with style
PPTX
Toronto MuleSoft Meetup: Virtual Meetup #2
PDF
Php through the eyes of a hoster pbc10
PDF
Dutch PHP Conference 2013: Distilled
PDF
Code with Style - PyOhio
270_1_CIntro_Up_To_Functions.ppt
270_1_CIntro_Up_To_Functions.ppt
Survey of programming language getting started in C
CIntro_Up_To_Functions.ppt;uoooooooooooooooooooo
270_1_CIntro_Up_To_Functions.ppt 0478 computer
270_1_ChapterIntro_Up_To_Functions (1).ppt
Happy Coding with Ruby on Rails
Javascript done right - Open Web Camp III
Introduction To PHP000000000000000000000000000000.pptx
The Ring programming language version 1.5.1 book - Part 10 of 180
Symfony2 meets propel 1.5
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Function in cpu 1
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Code with style
Toronto MuleSoft Meetup: Virtual Meetup #2
Php through the eyes of a hoster pbc10
Dutch PHP Conference 2013: Distilled
Code with Style - PyOhio
Ad

Recently uploaded (20)

PDF
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
PDF
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
PDF
High-Quality PDF Backlinking for Better Rankings
PPTX
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
PDF
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
PPTX
Understanding Colour Prediction Games – Explained Simply
PDF
oppenheimer and the story of the atomic bomb
PDF
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
DOCX
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
PPTX
What Makes an Entertainment App Addictive?
PDF
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PPTX
genderandsexuality.pptxjjjjjjjjjjjjjjjjjjjj
PPTX
Other Dance Forms - G10 MAPEH Reporting.pptx
PDF
My Oxford Year- A Love Story Set in the Halls of Oxford
PPTX
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
PDF
Songlyrics.net-website for lyrics song download
DOC
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
PPTX
SPARSH-SVNITs-Annual-Cultural-Fest presentation for orientation
PPTX
the Honda_ASIMO_Presentation_Updated.pptx
PDF
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
High-Quality PDF Backlinking for Better Rankings
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
Understanding Colour Prediction Games – Explained Simply
oppenheimer and the story of the atomic bomb
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
What Makes an Entertainment App Addictive?
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
genderandsexuality.pptxjjjjjjjjjjjjjjjjjjjj
Other Dance Forms - G10 MAPEH Reporting.pptx
My Oxford Year- A Love Story Set in the Halls of Oxford
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
Songlyrics.net-website for lyrics song download
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
SPARSH-SVNITs-Annual-Cultural-Fest presentation for orientation
the Honda_ASIMO_Presentation_Updated.pptx
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
Ad

Turing-complete templates for everyone!

Editor's Notes

  • #2: recruiting now (can&amp;apos;t later) last standing survivor of Sophia.pm (not a typo) we&amp;apos;re hiring!
  • #3: not this, that France, accent Who already used Perl templating? Who&amp;apos;s going to attend Su-Shee&amp;apos;s talk?
  • #4: met in hallway only reasonable thing to do: create a new one Everybody knows what TC is? Are those frameworks TC?
  • #5: former Perl golfer LONG identifiers impure syntax
  • #7: seminal research project probably means: Awesome Contraption of Pure Computing Power no comments
  • #8: Almost like we had a type system
  • #12: This one had a huge bug on stage. So sue me.