VERSION|0.4.8|NAME|Guillaume Tatti|DATE|1227047874|CONTENT|Though I'm french like you, I will answer in english for other people to understand. [quote] I particularly like the "almost". Now if you find it great that everything returns a value, not only almost everything, why not using a real functional language? [/quote] It is just a little mistake from the book : just toy around a little with Interactive Ruby (irb) : just everything return a value. [quote] C'mon people. Ruby's blocks are just a miserable crutch for a language in which functions are not first class objects. [/quote] Waaaaa ? Methods (there is no function in Ruby, just methods) ARE objects. [code] class Foo def initialize(bar) @bar = bar end def method_bar puts @bar end end a_foo = Foo.new("bar") a_method = a_foo.method(:method_bar) a_method.call [/code] will print "bar". Not being able to retrieve the method directly by a_foo.method_bar does not mean methods are not objects, it means that you cannot access them directly because of strict encapsulation : you never access the member (attributes, methods) directly, you pass MESSAGES to the object's interface. And you have to pass a message to the object to retrieve one of his methods. Just consistent, clear pure OOP semantics here. [quote] but to do that [reflection, introspection] you need a new bunch of structure in your language: special data types, new methods to access the internals of other objects etc. [/quote] Completely wrong sir. It's is not like in Java, where you have to import a special package to do this. Special structures ? The "Class" class is built-in in the language, and doing [code] class Foo end [/code] is just syntactic sugar for [code] Foo = Class.new do end [/code] And every methods that serve introspection are also built-in. [quote] But wait! There's this problem with so-called "attribute writers": you have to call them explicitely with "self." in front. Otherwise, Ruby would take them for local variables! [/quote] Haha. Hahaha. MOUHAHAHAHAHAHA !! You never test anything do you ? [code] class Foo attr_reader :bar def initialize @bar = 5 end def toto bar + 6 end end puts Foo.new.toto [/code] will print "11". The "self." is necessary ONLY if a local "bar" variable is defined in the "toto" method, because in this special case Ruby just can't decide ! I have a lot of respect for Lisp and functional programming in general, although I can't get my mind to really understand it. But stop trash talking a language almost as pure as Smalltalk in his concept just because you cannot understand OOP. |EMAIL|guiledekmo@aol.com|IP-ADDRESS|192.168.1.103|MODERATIONFLAG|H