Why the compiler dosen't enforce correct module declarations?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Tue May 22 08:03:49 PDT 2007


Daniel Keep wrote:
> 
> 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
> 

I still don't see (as in, I dont' see) why one would need multiple 
version statements for your case.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D


More information about the Digitalmars-d-learn mailing list