Xref: utzoo comp.lang.smalltalk:1857 comp.lang.misc:4826 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!new From: new@udel.EDU (Darren New) Newsgroups: comp.lang.smalltalk,comp.lang.misc Subject: Languages that allow extensions to classes Message-ID: <16560@estelle.udel.EDU> Date: 11 Apr 90 19:16:51 GMT Reply-To: new@ee.udel.edu (Darren New) Followup-To: comp.lang.smalltalk Organization: University of Delaware Lines: 28 One feature of Smalltalk that I really like and use is the ability to put methods from one class into several files. This allows, for example, for the extention of already-defined classes with new methods. Example: I wish to extend Point and Rectangle to include a "scaleTo:" method. In Smalltalk, that method can be included into my application without disturbing the sources for the system and without recompilation of anything in the system. Even addition of new instance variables is possible (in ParcPlace systems, at least). I find this a MAJOR factor in software reusability. In C++, I (think) I have to change the header file, thereby requiring me to recompile all sources that reference that object. In Objective-C, I don't know if this is possible, especially without the sources to the other methods. In Eiffel (sp?) I understand that each class is defined within a single file, forcing me to -change- at least one system file (thereby maybe corrupting other hopefully-non-conflicting applications). I think adding overloaded functions for Ada types requires changes to the definition file, does it not? Or is that only for opaque types? In 2OL (my own experimental language) overloaded functions and messages automatically include themselves into the correct tables when compiled, thereby requiring no changes to somebody else's sources. Is my analysis of C++, Objective-C, and Eiffel correct? Does anybody know of other languages which allow the user to extend functionality of system classes/libraries/etc without changing files where the old stuff is defined? How about Ada