Are there any advantages or disadvantages to using class extensions over sub classes?
Some advantages of Extends methods: - vs non-Extends methods: They allow you to use dot syntax more of the time. This can help make code easier and to read and write. - vs class methods: They cannot use protected or private items in the class being extended. This helps avoid unnecessary dependencies. Some disadvantages of Extends methods: - vs non-Extends methods: They cannot be called on constant values. (A language bug, in my opinion.) You can get around this by defining non-Extends versions of all the routines of interest (cluttering your API) or you can define functions for each datatype of interest that return the input value (increasing your function overhead). - vs class methods: They cannot be contained within a class, so that within a class, you don't get the dot syntax advantage.
And avoids a lot of cases where previously one would have had to resort to inheritance.
Extends methods are simply module methods that are called using dot syntax, so they don't affect any problem that has to do with inheritance (other than the "problem" of not having enough dot syntax). lj _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
