Slide 1

Slide 1 text

@konstantinhaase github.com/rkh Beyond Ruby Exploring New Territories

Slide 2

Slide 2 text

@konstantinhaase github.com/rkh Konstantin Haase Open Source Developer

Slide 3

Slide 3 text

@konstantinhaase github.com/rkh

Slide 4

Slide 4 text

@konstantinhaase github.com/rkh “Second to K&R, the most lagom technical book I’ve read.” Peter Cooper (Ruby Inside) Discount Code: AUTHD 50% off ebook ($6.50) 40% off print

Slide 5

Slide 5 text

@konstantinhaase github.com/rkh

Slide 6

Slide 6 text

@konstantinhaase github.com/rkh A Programming Language is just a Tool

Slide 7

Slide 7 text

@konstantinhaase github.com/rkh Tell you something new

Slide 8

Slide 8 text

@konstantinhaase github.com/rkh No Node.js No Erlang No Go

Slide 9

Slide 9 text

@konstantinhaase github.com/rkh Full Object Orientation

Slide 10

Slide 10 text

@konstantinhaase github.com/rkh Doesn’t Ruby already have that?

Slide 11

Slide 11 text

@konstantinhaase github.com/rkh OOP ≠ OOP

Slide 12

Slide 12 text

@konstantinhaase github.com/rkh “Objects are data and functionality” Your High School Teacher

Slide 13

Slide 13 text

@konstantinhaase github.com/rkh

Slide 14

Slide 14 text

@konstantinhaase github.com/rkh “I made up the term object-oriented, and I can tell you, I did not have C++ in mind.” Alan Kay

Slide 15

Slide 15 text

@konstantinhaase github.com/rkh “ OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things.” Alan Kay

Slide 16

Slide 16 text

@konstantinhaase github.com/rkh Smalltalk

Slide 17

Slide 17 text

@konstantinhaase github.com/rkh if response == 42 "correct!" else "wrong" end

Slide 18

Slide 18 text

@konstantinhaase github.com/rkh response = 42 ifTrue: [ 'correct!' ] ifFalse: [ 'wrong' ]

Slide 19

Slide 19 text

@konstantinhaase github.com/rkh def true.if_true yield end def false.if_true end

Slide 20

Slide 20 text

@konstantinhaase github.com/rkh TrueClass. define_method(:if_true){ yield } FalseClass. define_method(:if_true) { }

Slide 21

Slide 21 text

@konstantinhaase github.com/rkh class Falsy def if_true; end end

Slide 22

Slide 22 text

@konstantinhaase github.com/rkh x = Delegator.new({}) x.is_a? Hash # => true case x when Hash then ... else fail end

Slide 23

Slide 23 text

@konstantinhaase github.com/rkh Do not treat Objects like Data Structures!

Slide 24

Slide 24 text

@konstantinhaase github.com/rkh my_instance. properties[:foo][1,4] == "blah" my_instance.foo? "blah"

Slide 25

Slide 25 text

@konstantinhaase github.com/rkh Is Smalltalk Object Oriented?

Slide 26

Slide 26 text

@konstantinhaase github.com/rkh variable/constant access is no method send keywords like self and super are no method sends

Slide 27

Slide 27 text

@konstantinhaase github.com/rkh no implementation treats ifTrue: and ifFalse: as method sends constants are not late bound

Slide 28

Slide 28 text

@konstantinhaase github.com/rkh Newspeak

Slide 29

Slide 29 text

@konstantinhaase github.com/rkh there are only method sends there is no global state

Slide 30

Slide 30 text

@konstantinhaase github.com/rkh But I want lexical scope!

Slide 31

Slide 31 text

@konstantinhaase github.com/rkh Foo = 42 class Bar def foo(x) Foo + x end end

Slide 32

Slide 32 text

@konstantinhaase github.com/rkh Outer = 23 module Wrapper Inner = 42 class Nested def result Outer + Inner end end end

Slide 33

Slide 33 text

@konstantinhaase github.com/rkh Solution: Clever, Bi- Directional Dispatch

Slide 34

Slide 34 text

@konstantinhaase github.com/rkh

Slide 35

Slide 35 text

@konstantinhaase github.com/rkh

Slide 36

Slide 36 text

@konstantinhaase github.com/rkh Homoiconic Languages

Slide 37

Slide 37 text

@konstantinhaase github.com/rkh "In computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in a primitive type of the language itself, from the Greek words homo meaning the same and icon meaning representation. This makes metaprogramming easier than in a language without this property." Wikipedia

Slide 38

Slide 38 text

@konstantinhaase github.com/rkh Lisp, Logix, Io Prolog, Snobol, Ioke

Slide 39

Slide 39 text

@konstantinhaase github.com/rkh

Slide 40

Slide 40 text

@konstantinhaase github.com/rkh '(1 2 3)

Slide 41

Slide 41 text

@konstantinhaase github.com/rkh (+ 1 2) ; 3

Slide 42

Slide 42 text

@konstantinhaase github.com/rkh (setf b 23)

Slide 43

Slide 43 text

@konstantinhaase github.com/rkh (car '(1 2)) ; 1 (cdr '(1 2)) ; '(2)

Slide 44

Slide 44 text

@konstantinhaase github.com/rkh (car (cdr '(1 2)))

Slide 45

Slide 45 text

@konstantinhaase github.com/rkh (setf a '(setf b 23)) (eval a)

Slide 46

Slide 46 text

@konstantinhaase github.com/rkh (setf a '(setf b 23)) (setf (car (cdr (cdr a))) 42) (eval a)

Slide 47

Slide 47 text

@konstantinhaase github.com/rkh

Slide 48

Slide 48 text

@konstantinhaase github.com/rkh How’s that useful?

Slide 49

Slide 49 text

@konstantinhaase github.com/rkh Macros and Partial Evaluation Language Extensions from within

Slide 50

Slide 50 text

@konstantinhaase github.com/rkh Declarative Programming

Slide 51

Slide 51 text

@konstantinhaase github.com/rkh SQL, XSLT, SPARQL, Pig Prolog, Erlang

Slide 52

Slide 52 text

@konstantinhaase github.com/rkh

Slide 53

Slide 53 text

@konstantinhaase github.com/rkh

Slide 54

Slide 54 text

@konstantinhaase github.com/rkh ruby_core(tenderlove). ?- ruby_core(tenderlove). Yes ?- ruby_core(X). X = tenderlove

Slide 55

Slide 55 text

@konstantinhaase github.com/rkh ruby_core(tenderlove). rails_core(tenderlove). ubercore(X) :- ruby_core(X), rails_core(X). ?- ubercore(X). X = tenderlove

Slide 56

Slide 56 text

@konstantinhaase github.com/rkh car([H|_], H). cdr([_|T], T). ?- car([1, 2, 3], X). X = 1 ?- cdr([1, 2, 3], X). X = [2, 3]

Slide 57

Slide 57 text

@konstantinhaase github.com/rkh sorted([]). sorted([_]). sorted([X,Y|T]) :- X =< Y, sorted([Y|T]). sort(X,Y) :- perm(X,Y), sorted(Y).

Slide 58

Slide 58 text

@konstantinhaase github.com/rkh Hardware Programming

Slide 59

Slide 59 text

@konstantinhaase github.com/rkh VHDL Very-high-speed integrated circuits Hardware Description Language

Slide 60

Slide 60 text

@konstantinhaase github.com/rkh FOO <= '1'; BAR <= '0'; BAZ <= FOO and BAR;

Slide 61

Slide 61 text

@konstantinhaase github.com/rkh github.com/a-team/Pong

Slide 62

Slide 62 text

@konstantinhaase github.com/rkh

Slide 63

Slide 63 text

@konstantinhaase github.com/rkh Thank you!