www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - import and module

reply kenny <funisher gmail.com> writes:
often times I want to recompile just a specific portion of a small 
project. This is a sorta small issue, but kinda annoying...

if I have this:

module xx1.yyy;
include xx2.yyy;

if I were to type dmd above.d in the cwd of \xx1 then I get an error 
saying it cannot import xx2.yyy. The default behaviour of inclusion IMO 
should be...

for every dot in the modulename, it should do that many cd .. before 
trying to include. It seems so natural that way...

module xxx; does nothing
module xxx.yyy; cd ..
module xxx.yyy.zzz; cd ../..

ideas?

peace
May 15 2005
next sibling parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
I agree (except changing the working directory, but I know what you 
mean.)  This would, more specifically allow:

src.abc
src.xyz
other.contrib.jkl
somelibrary.qrs

To work as expected, if make'ing from the src dir.

-[Unknown]


 often times I want to recompile just a specific portion of a small 
 project. This is a sorta small issue, but kinda annoying...
 
 if I have this:
 
 module xx1.yyy;
 include xx2.yyy;
 
 if I were to type dmd above.d in the cwd of \xx1 then I get an error 
 saying it cannot import xx2.yyy. The default behaviour of inclusion IMO 
 should be...
 
 for every dot in the modulename, it should do that many cd .. before 
 trying to include. It seems so natural that way...
 
 module xxx; does nothing
 module xxx.yyy; cd ..
 module xxx.yyy.zzz; cd ../..
 
 ideas?
 
 peace

May 15 2005
parent reply Mike Parker <aldacron71 yahoo.com> writes:
Unknown W. Brackets wrote:
 I agree (except changing the working directory, but I know what you 
 mean.)  This would, more specifically allow:
 
 src.abc
 src.xyz
 other.contrib.jkl
 somelibrary.qrs
 
 To work as expected, if make'ing from the src dir.

It does work as expected! If it's on the import path (-I or the config file), then they will be found. If not, they won't. Automatically doing a cd .. if a file cannot be found on the path is a nice convenience, but something that we can live without, IMO.
May 16 2005
parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
Of course.  I'm not going to cry if it doesn't happen, but essentially I 
just mean that... well, for the number of dots in the module name, that 
number of -I should be automatically assumed.  Examples:

module test;
	Should not assume anything.

module src.test;
	Should act as if -I.. was passed.

module src.main.test;
	Should act as if -I..\.. was on the command line.

Still, it's a very minor thing and I can definately live without it. 
But I think it does make sense.

-[Unknown]


 It does work as expected! If it's on the import path (-I or the config 
 file), then they will be found. If not, they won't. Automatically doing 
 a cd .. if a file cannot be found on the path is a nice convenience, but 
 something that we can live without, IMO.

May 16 2005
prev sibling parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"kenny" <funisher gmail.com> wrote in message 
news:d6779i$2ndl$1 digitaldaemon.com...
 often times I want to recompile just a specific portion of a small 
 project. This is a sorta small issue, but kinda annoying...

 if I have this:

 module xx1.yyy;
 include xx2.yyy;

 if I were to type dmd above.d in the cwd of \xx1 then I get an error 
 saying it cannot import xx2.yyy. The default behaviour of inclusion IMO 
 should be...

 for every dot in the modulename, it should do that many cd .. before 
 trying to include. It seems so natural that way...

 module xxx; does nothing
 module xxx.yyy; cd ..
 module xxx.yyy.zzz; cd ../..

 ideas?

 peace

I wouldn't mind if it did that only if the module couldn't be found on the standard import path. For example that way the compiler doesn't need to cd anywhere to find std.string or any other library I explicitly put on the path. But for an unknown package it would be nice to look around a bit for it. When it happens it isn't so bad to add the -I.. or -I../.. to the command-line, though.
May 15 2005