Metaprogramming in Ruby

612 views

Published on

My presentation in Ruby Athens Meeting @ oslab.teipir.gr

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

  • Be the first to like this

No Downloads
Views
Total views
612
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Metaprogramming in Ruby

  1. 1. Metaprogramming in Ruby Creating languages in just a sec!     http://jon.is.emotionull.com
  2. 2. Creating a language  Parsers from scratch  Bison/yacc/lex   Metaprogramming FTW!    
  3. 3. Hacko!  Example // this is a test (example.hacko) include ”stdio” main {     printf ”Hello Mr. %s !”, ”Jon” }         
  4. 4. Bow to the masters  Lisp  Scheme  Forth  Smalltalk     
  5. 5. Thinking again the problem  Code as data  Self modifying code  Dynamic adding/removing classes/functions  Describe the problem, don't solve it!    
  6. 6. Metaprogramming in the wild  Web frameworks (Ruby On Rails)  A.I  DSL  Configuration files  ...    
  7. 7. But, hooooow???  Function pointers (C,C++)  Open classes (Ruby)  Metaclasses (Python)  Lists (Lisp/Scheme/Clojure)    
  8. 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. 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. 10.   Thank for watching! Questions? http://jon.is.emotionull.com jon@emotionull.com    

×