[plt-scheme] "appending" to classes rather than extending

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Mar 6 19:23:52 EST 2008

Generic functions (say as in c-lost or swindle) are fine with me, but  
I don't think they are similar to this idea of opening any random  
class and adding functionality or patching it. I tend not to think of  
generic functions as methods proper. -- Matthias

On Mar 6, 2008, at 7:13 PM, Jakub Piotr Cłapa wrote:

> Grant Rettke wrote:
>> On Thu, Mar 6, 2008 at 8:13 AM, Matthias Felleisen  
>> <matthias at ccs.neu.edu> wrote:
>>> On Mar 6, 2008, at 9:06 AM, Chris Uzdavinis wrote:
>>>> In Ruby, when you extend types, it affects existing objects of that
>>>> type too.  Below, my_object is bound to an object created when X  
>>>> is an
>>>> "empty" class, and then I add a bar method, and it's immediately
>>>> available.
>>> I was afraid it would.
>>> From my perspective, most languages have, at one time or another,  
>>> had
>> some guiding vision or force behind them.
>> Eiffel has Bertrand Meyer saying "Everything is an object, and be
>> static about it" and C++ has Bjorned Stroustrop saying "Keep it fast,
>> keep it generic", Scheme "Programming languages should be designed  
>> not
>> by piling feature ...".
>> Ruby has Yukihiro Matsumoto saying "It makes sense to me, if you  
>> don't
>> like it, see you later!" hahaha
>> Consequently there are a lot of really "neat" things you can do in
>> Ruby, but it is not always obvious to me why you might want to do
>> those things (I'm excluding the *obvious* ones so give me a break on
>> those). Mats knows, and if you don't "get it" oh well!
> This particular feature is quite useful when you need to patch some  
> class you don't hae source code for.
> The main (not Ruby) users of such a feature are probably the  
> Objective-C folks programming for NeXTSTEP/OS X (it's called  
> categories and has it's limitations but hey, Objective-C was  
> pioneering) . They seem to like it.
> Oh. And there is this prototype based JavaScript which obviously  
> also supports it. It works good as long as you use only one JS  
> library at a time (namespace collisions are mostly ignored in the  
> OO world; generic functions seem to fix this and are the most  
> dynamic approach?). ;]
> PS. Matthias, do you dislike generic functions?
> -- 
> regards,
> Jakub Piotr Cłapa
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.