A question about modules

Myron Alexander someone at somewhere.com
Tue Jun 12 09:53:05 PDT 2007


Hello.

My understanding of D is still maturing so I may make some glaringly 
incorrect statements. Please correct me if I am wrong. I may also ramble 
a bit but then I have not slept since midday yesterday. (BTW I did 
search on the newsgroups, found nothing on this topic so I hope I am not 
opening any old wounds).

I am trying to package my library for use in another project of mine. My 
problem is that I make extensive use of templates in the library so I 
cannot just create a static library with some prototype .di files. I am 
used to the Java jar files and would like to know if it is possible to 
do something like that for D (even if it is only a zipped up source 
library).

Right now I am copying my library source tree into the project, not a 
great solution. I was also looking at how to hide the template 
implementation which got me thinking.

I would also like to know if there are any technical reasons that D 
could not adopt a binary format module mechanism. In Java, you import 
the compiled class file, not the source. I cannot think of a reason why 
D should not be able to do the same. The library would not be a C 
compatible library but then this is the language D.

As it stands, if you want C compatibility, you have to code C specific 
interfaces so nothing would change on that front, except that you would 
have to tell the compiler that you are generating a C compatible 
library. Thus we have a compiler that spits out D modules by default and 
can produce C libraries on demand (not advocating automatic conversion, 
the developer would have to do the interface dirty work as it currently 
stands).

I hope I made some sense.

What are you thoughts on this matter?

Regards,

Myron Alexander
dprogramming...myron...alexander...com
replace the first ... with @, remove the second, and replace the third 
with ".".



More information about the Digitalmars-d mailing list