On 06/26/10 00:11, Neil Hodgson <nyamatongwe+thun...@gmail.com> wrote:

> WANG Cong:
>
>> 4) Also, this will _somewhat_ violate the OOP princples, in OOP,
>> this is and should be implemented by inherence.
>
>    Most object oriented programming languages starting with Smalltalk
> have allowed adding attributes (addInstVarName) to classes at runtime.


Thanks, I have to admit that I know nothing about Smalltalk.

>From what you are saying, Smalltalk picks a way similar to setattr() in
Python? Because you mentioned 'addInstVarName' which seems to be a
method or a builtin function. If so, that is my point, as I mentioned
earlier, switching to setattr() by default, instead of using assignments
by default. :)

> Low level OOPLs like C++ and Delphi did not implement this for
> efficiency reasons.
>

Hmm, although this is off-topic, I am interested in this too. C++ does
have metaprogramming, but that is actually static metaprogramming (using
templates), not dynamic metaprogramming here. I am wondering if
efficiency is the only reason why C++ doesn't have dynamic
metaprogramming, since C++ is a static programming language I think if
this limits C++ to implement its dynamic metaprogramming actually...

Thanks.

-- 
Live like a child, think like the god.
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to