Centralizable configured compile-time class instantiation

shd alienballance at gmail.com
Wed Jul 13 15:23:00 PDT 2011


2011/7/13 Jesse Phillips <jessekphillips+D at gmail.com>:
> shd Wrote:
>> 2011/7/13 Jesse Phillips <jessekphillips+D at gmail.com>:
>> > You say no to libraries
>>
>> That's not true! I'm not sure how did you came up to this conclusions,
>> but i love libraries for applications same as command-line programs
>> (like ffmpeg) for GUI apps.
>
> It comes from, "and APIs are not what i'd love to work with[...]"
Yeah, but it doesn't mean i don't like library concept.

The other thing is, i'm not saying libraries i'm using got bad APIs.
They're not D, so they have to be C which means APIs aren't OO and i'd
like to use in my code OO things which are good integrating with D
language features. Furthermore, API is the only one of aspects for
choosing library for yourself.


> A good library provides a good API. You build reusable code by creating a library that defines interfaces and routines that can be used by many applications.
>
> You make a library replaceable by providing defined interfaces and routines that another library can mimic.
>
> You generally don't provide a project that allows swapping out an implementation detail from a compiler switch, such as which Associative Array library to use. If you are doing graphical display you might want to support rendering to Cairo or QT or Windows Forms, but this means you will have to write the code that works with them. Or you'll have to define the API for which your library expects of a graphics rendering library and the person wanting to use one will need to write a wrapper for one of these libraries to conform to your API. This means they will have to write some code and will be using their own build setup and not one you have provided.

I see your point, but i'm young enough to try things on my way first.
If it won't work, i'll refactor/drop whatever.The only things i don't
want to implement, are if someone already tried it, described that it
failed (and WHY), If you see something against swappable
implementations besides of performance and 'you can abstract it out',
then i'll gladly hear. It's a personal project where i'm making first
steps in this area, so i'd like to take advantage of my freshness. I'm
not doing it because i have to feed myself and my family, nor someone
(besides of me) isn't attached to success of it. If only thing i get
from it is knowledge (and fun), good for me. So, if the only thing
against is, 'generally people are doing other way' - it's ok for me to
try my way.

Anyway, it's not true that people aren't swapping implementations
during compilation. Most famous example i believe would be linux
kernel and it's config. Can't you tweak scheduler algorithm, or 439284
other options? Yes, you can. I think it's cool.


> I hope I'm being a little helpful, or at least you can see where I'm getting confused. Anyway it seems you got something workable (I was hoping someone else would pick this up if I asked the initial questions and it worked).
Yep, you helped a lot. Thank you.


More information about the Digitalmars-d-learn mailing list