Re: [AD] Export AL_VECTOR |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On June 18, 2008, Peter Wang wrote:
> On 2008-06-18, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> > On June 18, 2008, Peter Wang wrote:
> > > On 2008-06-18, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> > > > Without a public AL_VECTOR, I'd have to either use char** arrays, or
> > > > implement my own dynamic array api just for the fs api. I find that
> > > > wrong on a few levels.
> > >
> > > You can export an (opaque) resizable array API which is specific to the
> > > fs API, and implement that using _AL_VECTOR. Would that be okay?
> >
> > I personally think that's still dirty. I then have to duplicate the api.
> > then what happens to parts of the api that also need a resizeable array?
> > Do they then duplicate the interface again?
>
> Yes. On the plus side you can present a subset or specialised interface
> of the operations that make sense, and retain type safety (which is the
> main problem with a generic interface in C).
>
> Not that I'm in favour of code duplication. Can you explain how you
> plan to use the vectors in your fs API?
To start with, people want to play with path names. splitting them up into
component parts, adding entries, changing some, and re joining them up into a
final path name.
I could also use it for other parts of the api, that return char**s or some
other kind of list.
I could see using a vector in the multi mon code as well. returning a list of
screens, and modes for each, etc. There are several places in the allegro API
that could be simplified if they could all use a common vector type. And then
the returned data could be made more usefull, by allowing the user to modify
those lists, should they need to, without making intermediate copies. Of
course in some cases it wont be all that usefull to modify returned lists,
but it won't hurt anything either.
It just makes things more useable, and less static. imo.
> Peter
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
--
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx