From: "Peña, Botp" Date: 2008-04-23T19:51:02+09:00 Subject: Re: Ruby and object paradigm From: Andres [mailto:andresgaragiola@gmail.com] # I´m a smalltalk developer and now i'm beginning with Ruby. I found smalltalk is cool. # words like "puts" on the ruby syntax that i don´t understand. rtfm ;) # The basic object paradigm formula is "receiver + message", an emisor # send a message to a receiver. yes. but ruby is nice. it does not "forces" us to do things just because of some oo paradigm.. remember, not everyone view the programming world as receiver.message only; eg, i feel at ease writing 1+1 instead of 1.+ 1 ;) # is # Transcript show: 'Hello world' if you want a longer way, no problem. 070:0> Kernel.puts "hello" hello => nil note, other objects may implem puts too, but you already know that ;) # factorial # ^self = 0 ifTrue: [ 1 ] ifFalse: [ self * ((self-1) factorial) ] another way in ruby 059:1> def factorial 060:2> self==0 ? 1 : self * (self-1).factorial 061:2> end => nil # the message #ifTrue:ifFalse: is implemented in the class Boolean and # in his subclasses, and receive two block argmuments, the behavior if # the boolean is true and the behavior if the boolean is false. I don´t # understand like it works in ruby, when is implemented the message "if # else"? 1 current ruby does not support multiple blocks as arguments 2 current ruby does not have boolean class 3 this ruby group is composed of many smalltalk hackers (who have now become ruby hackers too). you are not alone. search the archives. see also the rubinius project. kind regards -botp