[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Is better to subclass or to add methods to an existing class?
From:       Tanaka Akira <akr () m17n ! org>
Date:       2002-09-20 3:30:41
[Download RAW message or body]

In article <odji9.4863$3F1.23903@weber.videotron.net>,
  Vincent Foley <vinfoley@iquebec.com> writes:

> Can you enligthen me and tell me if it's really that bad an idea to add
> methods to an existing class, or if he's just being a Python zealot?

Currently it is not great idea because name crash in method names.
But if matz introduce selector namespace into Ruby, we can avoid the
problem.

If name crash can be solved (by selector namespace or some prefix),
I think it is good idea.  For example, we don't need Visitor pattern
with such modifiable class.

> I'd also like to know if other OO languages (SmallTalk, Eiffel, Sather,
> etc.) allow class modifications.

Various (but mainly research) languages have it:
CLOS, AspectJ, MultiJava, Cecil, MixJuice etc.

The author of a paper of MultiJava calls the modifiable class `open
class'.
-- 
Tanaka Akira
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic