SlideShare a Scribd company logo
Metaprogramming in Ruby


Creating languages in just a sec!




                               
                                    http://jon.is.emotionull.com
Creating a language

       Parsers from scratch
       Bison/yacc/lex 
       Metaprogramming FTW!




                                
Hacko!

       Example

         // this is a test (example.hacko)
         include ”stdio”
         main {
             printf ”Hello Mr. %s !”, ”Jon”
         }     



                                    
Bow to the masters

       Lisp
       Scheme
       Forth
       Smalltalk 




                      
Thinking again the problem

       Code as data
       Self modifying code
       Dynamic adding/removing classes/functions
       Describe the problem, don't solve it!




                                
Metaprogramming in the wild

       Web frameworks (Ruby On Rails)
       A.I
       DSL
       Configuration files
       ...




                               
But, hooooow???

       Function pointers (C,C++)
       Open classes (Ruby)
       Metaclasses (Python)
       Lists (Lisp/Scheme/Clojure)




                                
Speed penalty – Not always

       Premature optimization
       Fast and smart VM (JVM)
       Bottleneck is somewhere else
       You are not smart enough. Deal with it!




                               
Hacko!

       Implemented in ~ 10 minutes
       Looks like C
       Feels like C
       FULLY extensible
       Trivial to add new libraries
       You can use available Ruby libs
       VM ~ 25 lines!
                                 
 




    Thank for watching! Questions?




        http://jon.is.emotionull.com
           jon@emotionull.com
                     

More Related Content

What's hot (13)

PDF
Consider the following BNF grammar: implement a recursive descent parser tha...
hwbloom143
 
PDF
Code rippa
Benjamin Tan
 
ODP
Rebol brainwasher
crazyaxe
 
KEY
PHP to Python with No Regrets
Alex Ezell
 
ODP
Rebol
crazyaxe
 
PDF
I35s
ujihisa
 
DOCX
Sistemas
leiderserna
 
PDF
AddisDev Meetup ii: Golang and Flow-based Programming
Samuel Lampa
 
PPTX
C c#
Sireesh K
 
PPTX
Gdg dev fest 2107 to kotlin, with love
Ayman Mahfouz
 
PPT
Coldfusion
Ram
 
ODP
How to join open source development
Kan-Ru Chen
 
ZIP
An Introduction to PyPy
Michael Hudson-Doyle
 
Consider the following BNF grammar: implement a recursive descent parser tha...
hwbloom143
 
Code rippa
Benjamin Tan
 
Rebol brainwasher
crazyaxe
 
PHP to Python with No Regrets
Alex Ezell
 
Rebol
crazyaxe
 
I35s
ujihisa
 
Sistemas
leiderserna
 
AddisDev Meetup ii: Golang and Flow-based Programming
Samuel Lampa
 
C c#
Sireesh K
 
Gdg dev fest 2107 to kotlin, with love
Ayman Mahfouz
 
Coldfusion
Ram
 
How to join open source development
Kan-Ru Chen
 
An Introduction to PyPy
Michael Hudson-Doyle
 

Viewers also liked (12)

PPS
Pyramids builders
mohsen hassan
 
PPS
Tomame O DéJame
borlcan
 
PDF
Modul p.point 2007
Den Mas Margasem
 
PPT
Case Study - uvedení nového projektu - Galerie panenek DollsLand
BenedaGroup.com
 
PDF
Topological Inference via Meshing
Don Sheehy
 
PDF
Approximate Centerpoints with Proofs
Don Sheehy
 
PPT
Internet, sociální sítě a nová media v marketingové komunikaci
BenedaGroup.com
 
PDF
Rails vs Web2py
jonromero
 
PPT
Internet & sociální sítě v marketingové komunikaci - přednáška VŠE 12/2012
BenedaGroup.com
 
PPTX
Presentación2
ferpal
 
PPT
Online marketing & new media | BenedaGroup.com
BenedaGroup.com
 
Pyramids builders
mohsen hassan
 
Tomame O DéJame
borlcan
 
Modul p.point 2007
Den Mas Margasem
 
Case Study - uvedení nového projektu - Galerie panenek DollsLand
BenedaGroup.com
 
Topological Inference via Meshing
Don Sheehy
 
Approximate Centerpoints with Proofs
Don Sheehy
 
Internet, sociální sítě a nová media v marketingové komunikaci
BenedaGroup.com
 
Rails vs Web2py
jonromero
 
Internet & sociální sítě v marketingové komunikaci - přednáška VŠE 12/2012
BenedaGroup.com
 
Presentación2
ferpal
 
Online marketing & new media | BenedaGroup.com
BenedaGroup.com
 
Ad

Similar to Metaprogramming in Ruby (20)

PDF
Metaprogramming in Ruby
John Vlachoyiannis
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
PDF
IJTC%202009%20JRuby
tutorialsruby
 
PDF
Ruby for C#-ers (ScanDevConf 2010)
Thomas Lundström
 
PDF
Ruby an overall approach
Felipe Schmitt
 
PDF
The Enterprise Strikes Back
Burke Libbey
 
PDF
Ruby — An introduction
Gonçalo Silva
 
PPTX
Adventures of java developer in ruby world
Orest Ivasiv
 
PDF
Comparing groovy and_j_ruby(neal_ford)
Dmitry Nosenko
 
KEY
Introduction to Ruby
Mark Menard
 
PDF
Ruby Presentation
platico_dev
 
PDF
Reddirt2011
Brian Ford
 
ODP
Novice Programmers Workshop
Alec Clews
 
PDF
Culture And Aesthetic Revisited
Adam Keys
 
PPT
Intro To Ror
myuser
 
PDF
Cimplementation
Praveen Kumar
 
PDF
JRuby, Not Just For Hard-Headed Pragmatists Anymore
Erin Dees
 
PDF
Ola Bini Evolving The Java Platform
deimos
 
ODP
Ruby
Aizat Faiz
 
PDF
Intro to J Ruby
Frederic Jean
 
Metaprogramming in Ruby
John Vlachoyiannis
 
IJTC%202009%20JRuby
tutorialsruby
 
IJTC%202009%20JRuby
tutorialsruby
 
Ruby for C#-ers (ScanDevConf 2010)
Thomas Lundström
 
Ruby an overall approach
Felipe Schmitt
 
The Enterprise Strikes Back
Burke Libbey
 
Ruby — An introduction
Gonçalo Silva
 
Adventures of java developer in ruby world
Orest Ivasiv
 
Comparing groovy and_j_ruby(neal_ford)
Dmitry Nosenko
 
Introduction to Ruby
Mark Menard
 
Ruby Presentation
platico_dev
 
Reddirt2011
Brian Ford
 
Novice Programmers Workshop
Alec Clews
 
Culture And Aesthetic Revisited
Adam Keys
 
Intro To Ror
myuser
 
Cimplementation
Praveen Kumar
 
JRuby, Not Just For Hard-Headed Pragmatists Anymore
Erin Dees
 
Ola Bini Evolving The Java Platform
deimos
 
Intro to J Ruby
Frederic Jean
 
Ad

Recently uploaded (20)

PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
July Patch Tuesday
Ivanti
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 

Metaprogramming in Ruby

  • 1. Metaprogramming in Ruby Creating languages in just a sec!     http://jon.is.emotionull.com
  • 2. Creating a language  Parsers from scratch  Bison/yacc/lex   Metaprogramming FTW!    
  • 3. Hacko!  Example // this is a test (example.hacko) include ”stdio” main {     printf ”Hello Mr. %s !”, ”Jon” }         
  • 4. Bow to the masters  Lisp  Scheme  Forth  Smalltalk     
  • 5. Thinking again the problem  Code as data  Self modifying code  Dynamic adding/removing classes/functions  Describe the problem, don't solve it!    
  • 6. Metaprogramming in the wild  Web frameworks (Ruby On Rails)  A.I  DSL  Configuration files  ...    
  • 7. But, hooooow???  Function pointers (C,C++)  Open classes (Ruby)  Metaclasses (Python)  Lists (Lisp/Scheme/Clojure)    
  • 8. Speed penalty – Not always  Premature optimization  Fast and smart VM (JVM)  Bottleneck is somewhere else  You are not smart enough. Deal with it!    
  • 9. Hacko!  Implemented in ~ 10 minutes  Looks like C  Feels like C  FULLY extensible  Trivial to add new libraries  You can use available Ruby libs  VM ~ 25 lines!    
  • 10.   Thank for watching! Questions? http://jon.is.emotionull.com [email protected]