www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 3rd party module usage decorum

reply nail <nail_member pathlink.com> writes:
I'm not familiar with module / package paradigm languages such as Java, Python
or smthng else. For a long time I used C++ only, but I like D. So the question
is: if I want to use some module of 3rd party author in my project what is a
best way to include it in my project? Copy files to a separate subdirectory and
use

import some.third.party.modoooole

in my project or copy files wherever I want, rename modules in 

module myproject.myname

(but of course keep copyrights)

or some another way is adopted?
Nov 26 2004
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
nail wrote:
 I'm not familiar with module / package paradigm languages such as Java, Python
 or smthng else. For a long time I used C++ only, but I like D. So the question
 is: if I want to use some module of 3rd party author in my project what is a
 best way to include it in my project? Copy files to a separate subdirectory and
 use
 
 import some.third.party.modoooole
 
 in my project

The simplest way is probably to install the packages in \dmd\src\phobos. Other options depend on how you structure your projects. If you use a single package hierarchy for your own stuff, then you can just as well install the third-party stuff under the root of that hierarchy. For example, I have packages smjg.libs and smjg.apps for my own stuff. They correspond to the paths D:\My Documents\Programming\D\smjg\libs and D:\My Documents\Programming\D\smjg\libs respectively. If I were to install a third-party library, then I could install your example as D:\My Documents\Programming\D\some\third\party\modoooole.d. Though I'd probably be more inclined to put it somewhere separate. I'm not sure if sc.ini allows you to specify multiple import paths, but in the current state of play I find myself using the -I switch quite a bit.... Stewart.
Nov 26 2004
parent reply nail <nail_member pathlink.com> writes:
In article <co7fcj$30h$1 digitaldaemon.com>, Stewart Gordon says...
nail wrote:
 I'm not familiar with module / package paradigm languages such as Java, Python
 or smthng else. For a long time I used C++ only, but I like D. So the question
 is: if I want to use some module of 3rd party author in my project what is a
 best way to include it in my project? Copy files to a separate subdirectory and
 use
 
 import some.third.party.modoooole
 
 in my project

The simplest way is probably to install the packages in \dmd\src\phobos. Other options depend on how you structure your projects. If you use a single package hierarchy for your own stuff, then you can just as well install the third-party stuff under the root of that hierarchy. For example, I have packages smjg.libs and smjg.apps for my own stuff. They correspond to the paths D:\My Documents\Programming\D\smjg\libs and D:\My Documents\Programming\D\smjg\libs respectively. If I were to install a third-party library, then I could install your example as D:\My Documents\Programming\D\some\third\party\modoooole.d. Though I'd probably be more inclined to put it somewhere separate. I'm not sure if sc.ini allows you to specify multiple import paths, but in the current state of play I find myself using the -I switch quite a bit.... Stewart.

Hm... in this case I will loose portability. Your folder D:\My Documents\Programming\D will grow the day after day with every new project (your or downloaded) and then if you will want to share one of your project based on some another modules you will have to remember all dependencies and include only necessary folders in archive. This can became a nightmare.
Nov 26 2004
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
nail wrote:
<snip>
 Hm... in this case I will loose portability. Your folder D:\My
 Documents\Programming\D will grow the day after day with every new project
(your
 or downloaded)

It would grow even more if I kept separate per-project copies of each library. But if you'd rather do that, it's up to you.
 and then if you will want to share one of your project based on
 some another modules you will have to remember all dependencies and include
only
 necessary folders in archive. This can became a nightmare.

At the moment I have my handful of projects and I know what libraries they use (mostly only Phobos, SDWF and a few other bits of my own code). When/if my collection of projects and libs reaches the point where I might forget what uses what, I guess I can look in my makefiles to recap on what libs are linked in. Stewart.
Nov 26 2004