"When you don't create things, you become
defined by your tastes rather than ability. Your
tastes only narrow and exclude people. So
create."
why the lucky stiff
Slide 14
Slide 14 text
Why a programming
language?
Slide 15
Slide 15 text
About programming languages:
"I don’t like any of them, and I don’t think any of
them are suitable for the real programming
problems of today, whether for systems or for
end-users"
Alan Kay
Slide 16
Slide 16 text
Problem Oriented
Programming Languages
Cairo (~120k SLOC in C) rewritten in less than
400 lines
Slide 17
Slide 17 text
Why Smalltalk?
Slide 18
Slide 18 text
Why Rubinius?
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
1 + 1
1 + 1
Slide 21
Slide 21 text
this is it
this.is.it
Slide 22
Slide 22 text
GoGaRuCo rock: #hard
GoGaRuCo.rock :hard
Slide 23
Slide 23 text
doc convertFrom: #xml to: #yaml
doc.convert(:xml, :ruby)
Slide 24
Slide 24 text
doc convertFrom: #xml to: #yaml
doc.convert from: :xml, to: :ruby
Slide 25
Slide 25 text
[ 42 ]
proc { 42 }
Slide 26
Slide 26 text
anArray do: [ :each | each doSomething ]
an_array.each do |element|
element.do_something
end
Slide 27
Slide 27 text
Textmate version = 2
ifTrue: [ 'no way' ]
ifFalse: [ 'thought so' ]
if Textmate.version == 2
"no way"
else
"thought so"
end
class Object
dynamic_method(:display) do |g|
g.push_self
g.push_local(0) # first argument
g.send(:puts, 1, true)
g.ret
end
end
display "Hello World"
Slide 43
Slide 43 text
Reusing the Rubinius
tool chain
Slide 44
Slide 44 text
No content
Slide 45
Slide 45 text
class Reak::Compiler < Rubinius::Compiler
class Parser < Stage
stage :parser
next_stage Generator
end
end
Slide 46
Slide 46 text
class CustomNode < Reak::AST::Base
def self.bootstrap_grammar(g)
# grammar definition
end
def bytecode(g)
# bytecode definition
end
end
Slide 47
Slide 47 text
class ConstantAccess < Rubinius::AST::ConstantAccess
include Reak::AST::Node
Reak::AST::Primary.push self
def self.bootstrap_grammar(g)
g.t /[A-Z][a-zA-Z0-9_]*/
end
# no bytecode definition necessary
end
Slide 48
Slide 48 text
Rubinius.AST.TrueLiteral subclass: #TrueLiteral [
Reak.AST.Primary push: self.
self include: Reak.AST.Node.
self class >> grammar: g [
^ g str: 'true'
].
]
Reak.AST.Base subclass: #Cascade [
Reak.AST.Expression push: self.
bytecode: g [
g pushSelf.
cascadedSends do:
[:send |
g dup.
send bytecode: g.
g pop ].
lastSend bytecode: g.
]
]