Nick Sabalausky wrote:
"Don" <[email protected]> wrote in message
news:[email protected]...
Steve Schveighoffer wrote:
On Wed, 11 Feb 2009 09:01:29 +0100, Don wrote:
I think I have a solution to the versioning problems. My belief is that
version statements are fine, and Walter's 'rats nest' argument is valid.
Instead, I believe that version declarations limited to "version = XXX;"
are too weak. They also have syntax which is subtly different to the
rest of the language. (version = A; version = B; looks as though you're
changing the value of the 'version' variable).
My proposal is therefore:
--------
* Keep version statements unchanged.
* Change version declarations to make them almost identical to bool
declarations:
version _versionidentifier_ = _versionexpression_;
I like this idea. I had one similar last night, but you beat me to it ;)
My idea was going to be something that is similar to the current version
statements:
version = _expression_ ? _identifier_ [ : _elseidentifier_ ]
Where the [...] is optional.
But your way looks cleaner.
Not in love with the version x = extern notation ...
Me neither. Of the two options I presented, I've decided I prefer
extern version x;
But there should be a way to specify a default value.
But only existence can be set on the command line, exactly as now.
So default is always false.
For an extern identifier,
true = it was specified on command line, false = it was not specified.
Considering your worst case:
> // FeatureX *can* be specified on cmd line, default is complex.
> extern version FeatureX = (FeatureA || !FeatureB) && Windows;
> version(FeatureX)... // Ok
You could only do this with TWO extern features, one to enable it, one
to disable.
extern version EnableFeatureX;
extern version DisableFeatureX;
version FeatureX = (((FeatureA || !FeatureB) && Windows) ||
EnableFeatureX ) && ! DisableFeatureX;
With what you're proposing, you'd need to change the command line syntax
too.