Why the compiler dosen't enforce correct module declarations?

Daniel Keep daniel.keep.lists at gmail.com
Fri May 18 19:47:31 PDT 2007



Bruno Medeiros wrote:
> Daniel Keep wrote:
>> 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.
>>
> 
> Let me see if I got this correct, because I also do not understand how
> this could not be done just as good with versioning. You said you don't
> want to put "version flags in every place this switch happens". Did you
> mean every place that uses/imports the Camera module?
> Why not just have the Camera module change implementations according to
> the version (like Chris mentioned) ? Something like:
> 
> ---- engine/gx/camera/Camera.d ----
> module engine.gx.camera.Camera
> 
> version(OGL) {
>   // OGL implementation
> } else
> version(D3D) {
>   // D3D implementation
> }
> ---- ----

Because the plan is to eventually move to DDL.  Once I do that, I have
to go back and remove all of the version statements (that I didn't need
to put there in the first place), since linking will then be done at
runtime.  For now, I'm just using dmd to do DDL's job at compile time.

Also, I'm a damn stubborn bastard about these things: I've found a way
that works for me and I'll be damned if we lets anyone take it away from
usss, my precioussss!

:P

	-- 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