g-wrap-dev
[Top][All Lists]
Advanced

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

`wrap-as-wct!' too specific


From: Ludovic Courtès
Subject: `wrap-as-wct!' too specific
Date: Wed, 14 Sep 2005 16:05:14 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

Hi,

I consider the `wrap-as-wct!' method a bit too specific.  It is the only
way one can use a wrapset-specific implementation of <gw-wct>.  For
instance, <gw-guile-wct> is _not_ exported, so the only way to
instantiate a <gw-guile-wct> is using `wrap-as-wct!'.

However, it may sometimes be useful to subclass <gw-wct> in order to
define more specific behavior while still re-using the (Guile-specific)
<gw-wct> code, like:

  (define-class <my-object-type> (<gw-wct>))

  (define-method (destroy-value-cg (type <my-object-type>)
                                   (val <gw-value>) err)
    (list (next-method) "\n"
          "{ my_object_destroy (" (var val) "); }\n"))

However, since <my-object-type> doesn't inherit from <gw-guile-wct>,
methods like `wrap-value-function-cg' defined for the <gw-guile-wct>
class are not applicable to <my-object-type>.

Therefore, the user is mostly left with two choices:  either copy/paste
those methods, or stick to the simple `wrap-as-wct!', in which case it
becomes impossible to insert, for instance, specific destruction code.

One possibility would be to export <gw-guile-wct> and the likes, or have
a method like `wrapset-subclass-for' that returns the sub-class of a
given class for a given wrapset:

  (wrapset-subclass-for my-guile-wrapset <gw-wct>)

  |= <gw-guile-wct>

What do you think?

Thanks,
Ludovic.




reply via email to

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