[deimos] [tutorial] [rfc] How to set up a git repository to simplify keeping bindings up to date

Johannes Pfau spam at example.com
Sat Nov 12 00:50:39 PST 2011


Andrej Mitrovic wrote:
>It seems to me that people already use arbitrary ways of naming
>modules, IOW the deimos idea is becoming a mess:
>
>module deimos.libsndfile.d.sndfile;
>https://github.com/dawgfoto/deimos/blob/master/libsndfile/deimos/sndfile.di
>
>module ncurses;
>https://github.com/1100110/deimos-1/blob/master/ncurses/D/ncurses.d
>
>module deimos.lzma;
>https://github.com/jpf91/deimos/blob/liblzma/liblzma/deimos/lzma.d

Well, once the first project is added to deimos, we'll have some kind
of standard.

>Personally I think naming modules "deimos.modulename" is a bad idea.
>What if you want to use two C libraries in a single app which both
>define a module with the same name?

According to the deimos manifesto:
---------------------------------
Deimos is a collection of C header files to publicly available C
libraries and their translations to D. The idea is that if, in C, to
interface to a library one would write:
#include "foo.h"
then the corresponding D code would look like:
   import foo;
or:
   import deimos.foo;
---------------------------------
liblzma and systemD follow these conventions. Note that C libraries
with multiple headers often have a kind of namespace system:

#include "cairo/foo.h"
#include "cairo/file.h"
--> import deimos.cairo.foo;
--> import deimos.cairo.file;

>
>import deimos.tests;  // wanted lib1.tests
>import deimos.tests;  // wanted lib2.tests, woops!
>
>If deimos was just a directory name and not included in the module
>name we could have this sort of directory tree:
>
>/deimos/lbzma/file.di
>/deimos/lbzma/c/file.h
>/deimos/gtk/file.di
>/deimos/gtk/c/file.h
>/deimos/cairo/file.di
>/deimos/cairo/c/file.h
>
>The modules would be named as:
>module lbzma.file;
>module gtk.file;
>module cairo.file;
>
>And then the only thing you would have to do to start using any of
>these is add -I<path_to_deimos> to your projects, and you wouldn't
>have name clashes if you used more than one library.

I think the C headers already have to be named in a way to avoid
clashes, '/usr/include/tests.h' can only be provided by one library, so
usually we shouldn't get conflicts in deimos.

-- 
Johannes Pfau



More information about the Digitalmars-d-announce mailing list