Why version() ?
Walter Bright
newshound1 at digitalmars.com
Tue Feb 10 19:28:46 PST 2009
Steven Schveighoffer wrote:
> 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.
I cannot prove to you in any mathematical sort of way. All I can say is
that I have a lot of experience doing things both ways, and what the
results are. I can readily believe that it isn't obvious until one has
done it both ways; programming is full of examples of such. Such as:
#define BEGIN {
#define END }
I can't prove that's a bad idea, either. But experience shows it is <g>.
> 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;
I think I've been misunderstood here. I never intended one to actually
use the "or" string in a version, my intent was that one determine just
what the feature is that is AorB, and name the identifier that. For example:
version (linux)
version = Pthreads;
version (OSX)
version = Pthreads;
version (Pthreads)
...
else version (Windows)
...
I don't consider that cruft, but very reasonable self-documentation.
> 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 already did port it once, many years ago, it's why I know how hard it
is. Take a look at D's gc which uses personality modules. I ported that
to the mac pretty easily and never touched the main code. I can't even
figure out where the mac osx code is in the hbgc or what would need to
be changed for it. I couldn't even figure out if the hbgc supported OSX
or not.
To sum up, I've done it both ways. The personality module method
approach is head and shoulders the clear winner.
More information about the Digitalmars-d
mailing list