[Prev][Next][Index][Thread]

Re: Q: member syntax in dylan?



On Thu, May 10, 2001, Roland Paterson-Jones <rolandpj@bigfoot.com> wrote:

>The motivation is, of course, that it's fun to associate methods with their
>class, particularly when their are no multi-dispatch issues. I believe that
>this encourages object-oriented programming (having come, of course, from
>java and c++).

You should check out this article by Scott Meyers (author of Effective
C++ and More Effective C++ among other books), How Non-Member Functions
Improve Encapsulation, where the technique he is promoting is essentially
to do things more in the Dylan/CLOS style rather than in the Smalltalk/
Object-Pascal style.

http://www.cuj.com/articles/2000/0002/0002c/0002c.htm

Also note that generic functions allow you to add methods to existing
classes without subclassing them or even having access to their source. A
feature that has been proposed for Java.

The generic function approach is different than the simple-minded "stuff
the methods into the data and call it encapsulation" approach that is
pushed by the rest of the OO languages, but is demonstrably more general
and flexible.


Scott Ribe
scott_ribe@killerbytes.com
http://www.killerbytes.com/
(303) 665-7007 voice



References: