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 00:52:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Mark H Weaver <address@hidden> writes:

> Hello all,
>
> I was chatting with the folks working on Python-on-Guile, and it seems
> clear that they need the ability to create GOOPS objects that can
> emulate procedures.  Otherwise they will probably end up creating an
> entirely separate object system for Python, which would obviously be
> suboptimal.
>
> I think the most flexible approach is to add a standard generic function
> 'generic-apply' that gets called whenever someone tries to use a GOOPS
> object as a procedure.  I guess 'procedure?' should return true for a
> GOOPS object iff there exists an applicable method for 'generic-apply'.
>
> What do you think?

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>?

-- 
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]