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

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

Re: [Fwd: Re: First look at new g-wrap -- it's slow!]


From: Andreas Rottmann
Subject: Re: [Fwd: Re: First look at new g-wrap -- it's slow!]
Date: Mon, 24 May 2004 13:03:21 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Andy Wingo <address@hidden> writes:

> Hey,
>
> On Wed, 2004-05-12 at 16:19 +0200, Andreas Rottmann wrote:
>> Andy Wingo <address@hidden> writes:
>> 
>> > Takes care of depends-on! and the dual namespaces in one step. No more
>> > registry. Or if you don't like lists or quasi-quote you could do it like
>> > define-module does, with `#:use-wrapset <foo> #:use-wrapset <bar>' or
>> > something.
>> >
>> I think class arguments are resolved at definition time, so you'd get
>> 'undefined symbol <foo>', I think.
>
> Yes they are, but if you (use-modules) for all the wrapsets you depend
> on (which you have to anyway), they should be defined.
>
True.

>>  The registry however serves some other purposes:
>> 
>> 1) Assign a unique symbol to each wrapset independently of the class
>>    name; this is used e.g. for the name of the shared library.
>
> This information can be associated with the class itself, i.e. on a
> slot.
>
>> 2) Instanciate a given wrapset just once; e.g. when one has wrapsets
>>    A, B and C, both B and C depend on A. When you now create wrappers
>>    for B and C from the same program, A will only be instanciated
>>    once, instead of twice. I know we don't use this yet (only one
>>    wrapset generated by per guile invocation), but it might come handy
>>    performance-wise.
>
> This is surely premature optimization. Even if you needed it, you could
> have make-instance specialized for wrapsets to memoize the return value.
>
Agreed.

> It's not fatal or anything, but it's not very schemey to have multiple
> namespaces.
>
Hmm, a problem I've not yet listed and adressed by the registry:

3) It makes it possible to declare dependencies on other wrapsets that
   are then instantiated according to their language attribute; say we
   have this:

(define-class <wrapset-A> (<gw-wrapset>))
(define-class <wrapset-A-impl> (<wrapset-A>)
  #:language 'guile #:id 'A)

(define-class <wrapset-B> (<gw-wrapset>)
  #:dependencies '(A))
(define-class <wrapset-B-impl> (<wrapset-B>)
  #:language 'guile #:id 'B)

So we basically have two wrapsets, A and B, both refined for
Guile. When <wrapset-B-impl> is instantiated, an instance of
<wrapset-A-impl> should be created to fullfill the dependency. Note
that at the time the dependency is declared, the concrete class that
will fullfill it doesn't have to be known, and thus the need for a
separate namespace.

Andy
-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

Any technology not indistinguishable from magic is insufficiently advanced.
   -- Terry Pratchett




reply via email to

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