[#407] New feature for Ruby? — Clemens.Hintze@...
Hi all,
27 messages
1999/07/01
[#413] Re: New feature for Ruby?
— matz@... (Yukihiro Matsumoto)
1999/07/01
Hi Clemens,
[#416] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/01
On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:
[#418] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/01
Hi
[#426] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/02
Hi,
[#427] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/02
On Fri, 02 Jul 1999, you wrote:
[#428] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/03
Hi,
[#429] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/03
On Sat, 03 Jul 1999, you wrote:
[#430] Re: New feature for Ruby?
— gotoken@... (GOTO Kentaro)
1999/07/05
Hi,
[#431] Re: New feature for Ruby?
— Clemens Hintze <c.hintze@...>
1999/07/07
On Mon, 05 Jul 1999, you wrote:
[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>
Hi,
21 messages
1999/07/09
[#441] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/09
Hi,
[#442] Re: Now another totally different ;-)
— Clemens Hintze <c.hintze@...>
1999/07/09
On Fri, 09 Jul 1999, you wrote:
[#452] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/11
Hi,
[#462] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hello, there.
[#464] Re: Now another totally different ;-)
— Clemens Hintze <c.hintze@...>
1999/07/12
On Mon, 12 Jul 1999, you wrote:
[#467] Re: Now another totally different ;-)
— matz@... (Yukihiro Matsumoto)
1999/07/12
Hi,
[#468] Re: Now another totally different ;-)
— gotoken@... (GOTO Kentaro)
1999/07/12
In message "[ruby-talk:00467] Re: Now another totally different ;-)"
[#443] — Michael Hohn <hohn@...>
Hello,
26 messages
1999/07/09
[#444] interactive ruby, debugger
— gotoken@... (GOTO Kentaro)
1999/07/09
Hi Michael,
[#448] Re: interactive ruby, debugger
— "NAKAMURA, Hiroshi" <nakahiro@...>
1999/07/10
Hi,
[#450] Re: interactive ruby, debugger
— Clemens Hintze <c.hintze@...>
1999/07/10
On Sat, 10 Jul 1999, you wrote:
[#490] Some questions concerning GC in Ruby extensions — Clemens Hintze <c.hintze@...>
Hi matz,
6 messages
1999/07/14
[#501] Ruby 1.3.5 — Yukihiro Matsumoto <matz@...>
Ruby 1.3.5 is out, check out:
1 message
1999/07/15
[#519] CGI.rb — "Michael Neumann" <neumann@...>
Hi...
7 messages
1999/07/24
[#526] Another way for this? And a new proposal! — Clemens Hintze <c.hintze@...>
Hi,
6 messages
1999/07/25
[ruby-talk:00508] Re: One question about classes written in C.
From:
gotoken@... (GOTO Kentaro)
Date:
1999-07-20 08:23:41 UTC
List:
ruby-talk #508
Hi Cle,
In message "[ruby-talk:00506] Re: One question about classes written in C."
on 99/07/19, Yukihiro Matsumoto <matz@netlab.co.jp> writes:
>>Hmm, I think using is-a too much is bad funciton; use polymorphism
>>instead, if possible. I think I'm not going to add it not to
>>encourage using IS_A.
>
>In my class I need that function in the constructor and in the `+'
>and `-' method. In the constructor I have to ensure that only
>`Numeric's are used to initialize my instance. In the both arithmetic
>methods, I have to know, whether they operate on an instance of that
>class or not! Because adding a point to a point is a little bit
>different from adding a scalar to a point.
>
>Is there another function to detect these?
I often use `coerce technic' for the default action:
switch (TYPE(y)) {
case T_FIXNUM:
case T_BIGNUM:
/* something to do ... */
break;
case T_FLOAT:
/* something to do ... */
break;
default:
return rb_num_coerce_bin(x, y);
}
It's an idiomatic phrase. Indeed, we have only the three concrete
classes as the numeric.
# I'll add SingleFloat and DoubleFloat in the near future.
But you can use IS_A() macro if you need. I would NOT like to stop
that :-)
>One would have doing that connection in the `initialize' function
>again and again. So it would be no 1-n relation. One instance variable
>- --> one memory location under C. Somthing like:
>
> rb_connect_var(rb_intern("@x"), point->x);
>
>Perhaps we could also going the way to allow to tie a variable
>together with a method. Like your functions
>
> rb_define_hooked_variable,
> rb_define_virtual_variable.
>
>But for instance variables also.
>
>Perhaps it could also be nice to have that feature on Ruby level too.
I don't think it's nice because one doesn't have to set instance
variables in order to customize the class but she can use private
methods.
From the other point of view, customizing by instance variables seems
easy to cause bugs which are not easy to be found if the class is
implemented in C, i.e. in the situation where one can't see how an
instance variable is used inside of the object.
-- gotoken
# It is holiday `the sea day' in Japan but I don't know the meaning of
# today..