Why version() ?
Steven Schveighoffer
schveiguy at yahoo.com
Tue Feb 10 18:46:06 PST 2009
"Walter Bright" wrote
> Steven Schveighoffer wrote:
>> "Walter Bright" wrote
>>> Denis Koroskin wrote:
>>>> Does it look any better? No way!
>>> Of course doing it that way doesn't look any better, because it still
>>> just replicates the C preprocessor style of doing it.
>>>
>>> A far better solution is to create a series of modules:
>>>
>>> gcnetbsd.d
>>> gchurd.d
>>> gcsunos5.d
>>> ...
>>>
>>> and inside each one put the specifics for that particular system. The
>>> huge advantage of this is that if I want to create a BrightBSD operating
>>> system, I just have to write a:
>>>
>>> gcbrightbsd.d
>>
>> All you have done is split the mess into separate files. This does not
>> solve the problem.
>
> How does it not solve the problem?
I assume that the rats nest is necessary for the code to function.
Splitting up the rats nest into either a) mostly duplicated rats nests, or
b) individual chunks of rats nest still constitutes a rat's nest.
>>> rather than trying to carefully fold it into that conditional
>>> compilation mess without inadvertently breaking other platform support.
>>> (And I cannot even tell if I broke the SunOS5 platform support or not,
>>> because I don't have a SunOS5 platform to test it on.).
>>
>> But you have, because inadvertently, you changed some code in the actual
>> implementation to use the new identifiers you made in your special new
>> file. Now you have to go back and rethink the sunos include because you
>> broke it. Mess still exists. (of course, I have no idea, but I gave you
>> as much of an example/proof as you did ;)
>
> See my example of O_APPEND for the proof that it does solve the problem
> without breaking other platforms.
That example has nothing to do with || being allowed, and nothing to do with
your exhibit B. Your simple example makes sense to split into multiple
files, but you simply waved your magic "split into multiple files" wand at
Hans' code and because of the simplicity of D's versioning system, it's more
maintainable? I find it hard to believe without proof.
Besides, your example exists *without* any new features to the versioning
system. That is, your example just shows how it's easier to maintain if you
put the version identifier at the outermost layer, instead of in the
innermost layer, and I agree with you there. I just want to try and get rid
of the cruft of:
version(A)
version = AorB;
version(B)
version = AorB;
If you want to prove how much easier it is, actually split Hans' rat's nest
into multiple files how you would do it, and I'll show you that it isn't any
harder to maintain if you use ||. I think Nick already showed how much more
readable it is in one file (although he did also use ! in addition to || and
&&).
-Steve
More information about the Digitalmars-d
mailing list