[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: RES: RES: Cryptic OOP syntax
- From: Mark Hamburg <mhamburg@...>
- Date: Tue, 01 Feb 2005 15:08:09 -0800
on 2/1/05 2:44 PM, skaller at skaller@users.sourceforge.net wrote:
>> 2. A way to duplicate functions so that the same function can be given
>> different environments. (This might take the form of a general shallow-copy
>> routine.)
>
> Dubious :)
I'm not particularly enamored of super calls but some programming styles
really expect them to at least some extent. The naming approach is basically
another flavor of the cooperative subclassing model used by C++ and classic
Python. Having a keyword "super" really just relieves one of a certain
amount of maintenance when changing the class hierarchy and Lua could do
that as well with a simple local declaration:
local super = Foo
Baz = class "Baz" {
Foo,
-- Baz methods go here and can user super to name the superclass
}
Multiple inheritance with resolution schemes -- e.g., newer Python, some
mixin models -- need more power than you can get this way since the next
mixin will depend on the context in which a mixin is used. For example, one
might want to chain through readFromPrefsTable for all of the mixins making
up a class.
That being said, given that setfenv makes functions mutable entities, it
would be nice if one could replace the environment on a copy of a function.
This is independent of OOP needs though that's the case that is first coming
to mind.
Mark