Why the compiler dosen't enforce correct module declarations?

Daniel Keep daniel.keep.lists at gmail.com
Sat May 12 19:27:45 PDT 2007



Ary Manzana wrote:
> Manfred Nowak escribió:
>> Ary Manzana wrote
>>
>>> Why use an alternative of the built-in version system?
>>
>> The version system is not equivalent to the module naming system.
> 
> Ok. My point is that it is totaly unnecessary to have the module
> declaration say something different than it's location relative to the
> include source path. This is like things work in Java, for example: you
> get an error if the package declaration and the filesystem dosen't
> match. Why not apply the same in D?

I plan to use this while DDL is out of commission.

For instance: I have a class engine.gx.camera.Camera, which is just the
interface declaration (no actual contents).  I then have two different
implementations: one for GL and one for D3D; they both need to have the
same module name, but they exist in totally different places on the
physical filesystem.

And don't say "just use version()s" since I really don't want to have to
go around putting in version flags in every place this switch happens.
I just want to do it once at compile time and be done with it.

Hell, once DDL is working again, they won't even be linked together at
all.  The whole point of this is to allow someone to swap out which
implementation to use at run time; version()s won't let you do that :)

Besides, I don't see that this is a huge problem.  IDEs can just assume
the "normal" behaviour holds, and if they find it doesn't they can
either ignore it, or flag the modules in question for having odd names.

	-- Daniel

-- 
int getRandomNumber()
{
    return 4; // chosen by fair dice roll.
              // guaranteed to be random.
}

http://xkcd.com/

v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/


More information about the Digitalmars-d-learn mailing list