Beyond Ruby (RubyConf Argentina 2011)
Upcoming SlideShare
Loading in...5
×
 

Beyond Ruby (RubyConf Argentina 2011)

on

  • 1,773 views

Ruby is the most flexible language out there, imposing no limitations on the developers, giving all the expressiveness possible. Or so we think. But there are languages pushing dynamic features and ...

Ruby is the most flexible language out there, imposing no limitations on the developers, giving all the expressiveness possible. Or so we think. But there are languages pushing dynamic features and expressiveness far beyond what is possible in Ruby. Some are old, like Lisp and Smalltalk, some are just emerging, purely experimental languages, like Ioke or Newspeak. In this talk, we will take a look at some of these languages and what they can do that Ruby can't. What does it mean, to be homoiconic? How does a language without keywords work? Can I dispatch in more than one direction? And what is partial evaluation?

Statistics

Views

Total Views
1,773
Views on SlideShare
1,597
Embed Views
176

Actions

Likes
1
Downloads
2
Comments
0

4 Embeds 176

http://sempe.me 138
http://sempe.local 35
http://a0.twimg.com 2
http://us-w1.rockmelt.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Beyond Ruby (RubyConf Argentina 2011) Beyond Ruby (RubyConf Argentina 2011) Presentation Transcript

  • Beyond Ruby Konstantin Haase
  • La verdadera pregunta es ...
  • ¿Quién es el mejor fútbolista?
  • Ampliar tus horizonte. No deje Ruby ... ... evolucionar!
  • ¡Explora!
  • Por cierto ...
  • Vamos a empezar!
  • Goal: Tell you something new! no erlang, no go, no clojure no node.js
  • Full Object Orientation
  • Doesnt Ruby have that already?
  • OOP != OOP
  • "Objects are data and functionality." Your high-school teacher
  • "Actually I made up the term object-oriented,and I can tell you I did not have C++ in mind." Alan Kay
  • "OOP to me means only messaging,local retention and protection and hidingof state-process, and extreme late-binding of all things." Alan Kay
  • "OOP to me means only messaging,local retention and protection and hidingof state-process, and extreme late-binding of all things." Alan Kay
  • if respuesta == 42 "¡correcto!"else "equivocado"end
  • respuesta = 42 ifTrue: [ ¡correcto! ] ifFalse: [ equivocado ]
  • def true.if_true yieldenddef false.if_trueend
  • TrueClass.define_method(:if_true) { yield }FalseClass.define_method(:if_true) { }
  • class Falso def if_true; endend
  • x = Delegator.new({})x.is_a? Hash # => truecase xwhen Hash ...else failend
  • Dont treat your objects like data structures!
  • my_instance.properties[:foo][1,4] == "blah"my_instance.foo? "blah"
  • "OOP to me means only messaging,local retention and protection and hidingof state-process, and extreme late-binding of all things." Alan Kay
  • "OOP to me means only messaging,local retention and protection and hidingof state-process, and extreme late-binding of all things." Alan Kay
  • "A conforming processor may omit an invocation of a method of a built-in class or module for optimization purpose, and do the same calculation as the method instead. In this case, even if a program redefines themethod, the behavior of the program might notchange because the redefined method might not actually be invoked." Ruby Standard (JIS X 3017)
  • Every built-in Ruby method could actually be a keyword.
  • Is Smalltalk Object Oriented?
  • variable/constant access is no method send self/super is no method send
  • Also...no implementation treats ifTrue sends to a boolean as method send constants are not late bound
  • Newspeakthere are only method sends there is no global state
  • But I want lexical scope!
  • Foo = 42class Bar def foo(x) Foo + x endend
  • Outer = 23module Wrapper Inner = 42 class Nested def result Outer + Inner end endend
  • Solution: clever, bidirectional dispatch
  • Homoiconic
  • "In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in aprimitive type of the language itself, from the Greek wordshomo meaning the same and icon meaning representation. This makes metaprogramming easier than in a language without this property." Wikipedia
  • "In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in aprimitive type of the language itself, from the Greek wordshomo meaning the same and icon meaning representation. This makes metaprogramming easier than in a language without this property." Wikipedia
  • "In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in aprimitive type of the language itself, from the Greek wordshomo meaning the same and icon meaning representation. This makes metaprogramming easier than in a language without this property." Wikipedia
  • "In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in aprimitive type of the language itself, from the Greek wordshomo meaning the same and icon meaning representation. This makes metaprogramming easier than in a language without this property." Wikipedia
  • Homoiconic Languages Lisp, Logix, Prolog, Snobol, Io, Ioke, Lego
  • LISP
  • (1 2 3)
  • (+ 1 2) ; 3
  • (setf b 23)
  • (car (1 2)) ; 1(cdr (1 2)) ; (2)(car (cdr (1 2))) ; 2
  • (setf a (setf b 23))(eval a)
  • (setf a (setf b 23))(setf (car (cdr (cdr a))) 42)(eval a)
  • Hows that useful? Macros and Partial Evaluation Language extensions from within
  • DeclarativeProgramming SQL, XSLT, SPARQL, Pig
  • Did the last slide just say SQL and XSLT? Seriously?
  • declarative programming can be fun Prolog, Erlang
  • Prolog
  • ruby_core(tenderlove).?- ruby_core(tenderlove).Yes?- ruby_core(X).X = tenderlove
  • ruby_core(tenderlove).rails_core(tenderlove).ubercore(X) :- ruby_core(X), rails_core(X).?- ubercore(X).X = tenderlove
  • Prolog is Lisp, kindacar([H|_], H).cdr([_|T], T).?- car([1, 2, 3], X).X = 1?- cdr([1, 2, 3], X).X = [2, 3]
  • Sort a listsorted([]).sorted([_]).sorted([X,Y|T]) :- X =< Y, sorted([Y|T]).sort(X,Y) :- perm(X,Y), sorted(Y).
  • Thanks!github.com / rkh / presentations