[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Applicable GOOPS objects?
From: |
Mark H Weaver |
Subject: |
Re: Applicable GOOPS objects? |
Date: |
Sun, 25 Mar 2012 09:50:41 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
BT Templeton <address@hidden> writes:
> Mark H Weaver <address@hidden> writes:
>
>> BT Templeton <address@hidden> writes:
>>
>>> Would it work to simply have all Python metaclasses inherit from
>>> <applicable-struct-class>?
>>
>> On second thought, I see a problem with this idea: it would mean that
>> 'procedure?' would return true for _any_ Python object.
>>
>> In order to avoid this problem, the Python implementation would need to
>> know at class-creation time whether the __call__ method will be
>> supported. My knowledge of Python is very rusty, but I'm pretty sure
>> that the user could add a __call__ method at any time.
>
> True, but in GOOPS you'd have to change the object's class anyway to add
> a slot, I think. So the new dynamically-instantiated class could inherit
> from both the original class and <applicable-struct>.
I don't know why it would be necessary to redefine the class in order to
add a method, but this is an interesting idea nonetheless. One
potential issue is that references to the old class may linger, but that
can most likely be addressed by adding a level of indirection to class
references in Python. It's not an ideal solution, but it should work.
Thanks!
Mark