From: Robert Dober Date: 2008-04-22T17:28:34+09:00 Subject: Re: A couple of questions regarding class design On Tue, Apr 22, 2008 at 9:26 AM, Robert Klemme wrote: > 2008/4/22, Simon Krahnke : > > > > * Robert Klemme (2008-04-21) schrieb: > > > > > > > The return value of #initialize is ignored - always. > > > > > > Pardon? > > > > ,---- > > | #!/usr/bin/env ruby > > | > > | class Eins > > | def initialize > > | 1 > > | end > > | > > | def to_s > > | initialize.to_s > > | end > > | end > > | > > | eins = Eins.new > > | puts eins.to_s > > `---- > > > > Of course prints "1". > > > > You probably mean that Object::new ignores the return value of > > #initialize. > > Correct. Hehe, it never occurred to me to invoke #initialize as > ordinary method but I do see the point now. Thanks! Hey Robert I would have sworn like you, and in some ways it is almost better to believe it that way. However we want to know our language and this might be useful in metaprogramming, thanx Simon. Another thing Robert. IIRC correctly Ruby and Knuth do quite agree about goto, I believe that the usage Knuth made of goto is very much restricted to emulate exit, return, break, next, raise or throw. In a language without the aforementioned features their emulation with goto makes the code much simpler. (I remember how excited I was of Ada's "exit when ... " and "return" coming from Pascal. Cheers Robert > > Kind regards > > robert > > -- > use.inject do |as, often| as.you_can - without end > > -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein