www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Packages

reply Trevor Parscal <trevorparscal hotmail.com> writes:
So, I know this has been discussed before, but whats the reality of 
there being a way to have a source file and a directory, in the same 
directory, with the same name without a confliction?

Example:

// File Structure
<dir> utilities
	<dir> string // Contains the string class and core functionality
		regexp.d // Contains additional functionality
	string.d
//

// Code
import utilities.string; // imports "utilities/string.d"
import utilities.string.regexp; // imports "utilities/string/regexp.d"
//

Anyhoo, I am living without it just fine, but I would really like to see 
this in a future version. It could really help make people from other 
languages who are used to having more freedom with their source file 
structure feel more comfortable with D... Like me!

-- 
Thanks,
Trevor Parscal
www.trevorparscal.com
trevorparscal hotmail.com
Jun 27 2005
parent reply Victor Nakoryakov <nail-mail mail.ru> writes:
Trevor Parscal wrote:
 So, I know this has been discussed before, but whats the reality of 
 there being a way to have a source file and a directory, in the same 
 directory, with the same name without a confliction?
 
 Example:
 
 // File Structure
 <dir> utilities
     <dir> string // Contains the string class and core functionality
         regexp.d // Contains additional functionality
     string.d
 //
 
 // Code
 import utilities.string; // imports "utilities/string.d"
 import utilities.string.regexp; // imports "utilities/string/regexp.d"
 //
 
 Anyhoo, I am living without it just fine, but I would really like to see 
 this in a future version. It could really help make people from other 
 languages who are used to having more freedom with their source file 
 structure feel more comfortable with D... Like me!
 
It is made to avoid ambiguity I think. Consider: ------------------------------------------------ module foo; // src/foo.d struct S { int baz; } S bar; ------------------------------------------------ module foo.bar; // src/foo/bar.d int baz; ------------------------------------------------ module main; import foo, foo.bar; int main(char[][] args) { foo.bar.baz = 100; // what baz should be changed? return 0; } P.S. Sometimes I think that there are too many things in D that are made to avoid ambiguities wich appears one time per 100 years. The same is the reason of discussed lack of struct initializers and some other things. Maybe it would be better just to drop error message "ambigous bla bla bla" instead of forbiding to do such things at all?! This was rhetorical question... just my IMHO :) -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Jun 28 2005
parent Trevor Parscal <Trevor_member pathlink.com> writes:
In article <d9r0f5$krq$1 digitaldaemon.com>, Victor Nakoryakov says...
Trevor Parscal wrote:
 So, I know this has been discussed before, but whats the reality of 
 there being a way to have a source file and a directory, in the same 
 directory, with the same name without a confliction?
 *snip*
It is made to avoid ambiguity I think. Consider: *snip* P.S. Sometimes I think that there are too many things in D that are made to avoid ambiguities wich appears one time per 100 years. The same is the reason of discussed lack of struct initializers and some other things. Maybe it would be better just to drop error message "ambigous bla bla bla" instead of forbiding to do such things at all?! This was rhetorical question... just my IMHO :) -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Victor, I agree, that it COULD be a problem... So could allot of things.. BUT, the usefullness of having string be a module and regexp being a module that is organized below string, thus contextually displaying it's association with string, is far greater than being able to have a class named regexp in the string module AND having a module regexp organized below string. You SHOULD be able to do one or the other... And the code would not change.. I mean, why is D so very restrictive? To help us from having ambiguous code? I personally feel like its hurting us from having descriptive enough code. Anyone agree? --- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
Jun 28 2005