Index:
[thread]
[date]
[subject]
[author]
From: Andreas Beck <becka@rz.uni-duesseldorf.de>
To : ggi-develop@eskimo.com
Date: Wed, 21 Jul 1999 13:16:37 +0200
Re: Extensions
> > > What's the reasoning behind the multiple attachments
> O.K. Why did you design the GGI extension interface to
> allow multiple attachments. What's the reasoning behind this
> if all it does is increment a counter after the first
> attachment?
This allows to conveniently write extensions that rely on other extensions.
Say you have a Funky2d extension that uses calls to a Simple2d extension.
Now you want to write a program that uses calls to both the funky2d and the
simple2d extension.
The idea is, that you shouldn't have to worry about the intra-library
dependencies that are created by funky2d relying on simple2d.
With the multi-attach counting behaviour you can always simply attach both
extensions in your user program, and the funky2d extension will attach the
simple2d one another time with no harm done, as both will release it again
as well.
Using some isAttached() semantic would also work, but it is much more work
for the programmer, as you have to cache if it was attached to be able to
correctly detach it, and you are screwed, if you want to do non-bracketized
Attach/Detach sequences like Attach1 Attach2 Detach1 Detach2.
Such sequences make sense, as you might want to do something like
Funky2dAttach();
Simple2dAttach();
draw_some_funky_and_some_simple_stuff();
Funky2dDetach(); // We don't need the funky stuff for the rest of the
// program, so we might as well free the ressources.
draw_some_simple_stuff();
Simple2dDetach();
If you do that with an isAttached() scheme, you are screwed, as:
Funky2d will attach simple2d internally, as isAttached says it isn't.
The explicit call to simple2dAttach would then not be made, as isAttached
says it is already there.
Now when you detach Funky2d, it will as well detach Simple2d (as it cached,
that it attached it), and you are screwed.
Thus the counting behaviour is much more convenient, as you need to know
nothing about intra-library dependencies, and you can freely Attach/detach
anytime.
> I know what I'm doing, I'm just trying to figure out why
> you did things the way you did. No docs. :( Anyways, I
> append structures to the visual using the normal
> extensions interface in a linked-list fashion. The only
> thing I need is the determine whether or not the list is
> empty or unitialized. Thus, an isAttached() function would
> serve that purpose. After it is initialized, I can proceed
> to add nodes to the link list...etc.
? I don't get you here. Before using _any_ extension, you have to attach it.
If you don't, the program is faulty. Is that what you are hinting at ?
Detecting faulty programs that use extension functionality without
previously attaching it ?
--
= Andreas Beck | Email : <andreas.beck@ggi-project.org> =
Index:
[thread]
[date]
[subject]
[author]