Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Ruby Programmed Me

How Ruby Programmed Me

Closing keynote in RubyConf Uruguay 2013

Jano González

March 23, 2013
Tweet

More Decks by Jano González

Other Decks in Programming

Transcript

  1. “A language that doesn't affect the way you think about

    programming, is not worth knowing.” –Alan Perlis
  2. PROTOTYPES function Person(name) { this.name = name; } Person.protoype.sayHi =

    function() { return “Hi, I’m “ + this.name; }; var jano = new Person(‘Jano’); jano.sayHi();
  3. INDENTATION def median(pool): copy = sorted(pool) size = len(copy) if

    size % 2 == 1: return copy[(size - 1) / 2] else: return (copy[size/2 - 1] + copy[size/2]) / 2
  4. MACROS (defmacro for ((var start stop) &body body) (let ((gstop

    (gensym))) `(do ((,var ,start (1+ ,var)) (,gstop ,stop)) ((> ,var ,gstop)) ,@body)))
  5. STACK BASED : STAR! ( -- ) 42 EMIT ;

    : STARS!( n -- ) 0 DO STAR LOOP ; CR 7 STARS
  6. “The determined Real Programmer can write FORTRAN programs in any

    language.” –Ed Post close-minded? C, Ruby, Lisp, etc
  7. THINKER class AccountProtectionProxy def initialize(real_account, owner_name) @subject = real_account @owner_name

    = owner_name end def method_missing(name, *args) check_access @subject.send( name, *args ) end ... end