On Wednesday, 31 October 2012 at 23:01:52 UTC, dsmith wrote:
What is your way to import modules from other directory trees? Here is my (incorrect?) ideal:

Given:
/home/user/library_directory/

Containing:
lib_one.d
lib_two.d
lib_interface.d

lib_interface.d source:
module lib_interface;
public import lib_one, lib_two;

Implementation in program /home/user/programs/main.d:
cd /home/user/programs
ln -s /home/user/library_directory/lib_interface.d
// or include in dmd.conf: -I/path_to/library_directory

main.d source:
import lib_interface;
...

Compile program:
dmd main.d lib_interface.d

There is an emerging consensus that a import-everything-from-my-lib module should be called "all", see for example here:

http://prowiki.org/wiki4d/wiki.cgi?BestPractices#ConventionalModuleNameforImportingAllModulesinaPackage

Also, there has been an DIP adressing this:

http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP16

Reply via email to