[#419] Re: Contrast Ruby and Other Languages — Clemens Hintze <clemens.hintze@...>
Hi,
11 messages
1999/11/01
[#925] Re: Anybody knows of an English translation for... — Yasushi Shoji <yashi@...>
I don't have the originally posted mail so its thread is broken but..
4 messages
1999/11/24
[#927] Python complaints — matz@... (Yukihiro Matsumoto)
Hi,
11 messages
1999/11/25
[#930] Re: Python complaints
— gotoken@... (GOTO Kentaro)
1999/11/25
Hi,
[#931] Re: Python complaints
— Clemens Hintze <c.hintze@...>
1999/11/25
GOTO Kentaro writes:
[#937] Re: Python complaints
— William Park <parkw@...>
1999/11/25
On Thu, Nov 25, 1999 at 08:53:08AM +0100, Clemens Hintze wrote:
[ruby-talk:00898] Re: Contrast Ruby and Other Languages
From:
Clemens Hintze <c.hintze@...>
Date:
1999-11-02 05:29:59 UTC
List:
ruby-talk #423
GOTO Kentaro writes:
> Hi,
>
> In message "[ruby-talk:00895] Re: Contrast Ruby and Other Languages"
> on 99/11/01, Clemens Hintze <clemens.hintze@alcatel.de> writes:
>
> >- Ruby is an complete OOL. That mean all in Ruby is an object. Not in
> > the sense of Python or Perl. But in the sense of Smalltalk. The
> =========
>
> This may confuse some people because *all* in Smalltalk is an object,
> even controls. Indeed, one of my friends mistook in this point; He
> believed that even a control in Ruby are an object after he had heard
> Matz's talk (I've corrected his misunderstanding, then he looks being
> disappointed little).
I can understand him... But he, like me before, does a simple error...
All is *an* object, does not necessarily mean, that control structures
also have to be an object, IMHO. It only means to me, that all you can
graps or use (like: "hello", 1, proc{print"world"}) is an object. But
matz has decided, that blocks are not things you can grasp (yield
doesn't count here). Perhaps he has performance reasons? But you can
convert such a block to a Proc instance, so that it would be
graspable (nice word, isn't it? ;-)
Ruby could do it like Smalltalk, but then in that case Smalltalk's
syntax would be more appropiate, there.
I think,
class Proc
def ifThenElse(th,el)
if self.call
th.call
else
el.call
end
end
end
a = 5
(proc{a==5}).ifThenElse(
proc{print"Gotcha"},
proc{print"Missed"}
)
is possible, but looks, ahem, ugly?!?
After I was convinced to think this way, I could live with Ruby's
approach. I also would find it better, if Ruby behaves more like
Smalltalk here, but then ... Ruby is Ruby ;-)
>
> -- gotoken
>
\cle
--
Clemens Hintze mailto: c.hintze@gmx.net