guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applicable GOOPS objects?


From: BT Templeton
Subject: Re: Applicable GOOPS objects?
Date: Sat, 24 Mar 2012 19:48:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> BT Templeton <address@hidden> writes:
>
>> GOOPS defines an <applicable-struct-class> metaclass for this (similar
>> to AMOP's funcallable-standard-class):
>>
>> scheme@(guile-user)> (define-class <foo> (<applicable-struct>))
>> scheme@(guile-user)> ((make <foo> #:procedure car) '(1 2))
>> $1 = 1
>>
>> 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>.

-- 
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]