A Small Enhancement Idea

Xinok via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 2 18:26:01 PDT 2015


On Wednesday, 2 September 2015 at 19:34:53 UTC, Jack Stouffer 
wrote:
> On Wednesday, 2 September 2015 at 19:15:08 UTC, jmh530 wrote:
>> I wasn't familiar with version(release). Would you need to 
>> compile with -version=release then?
>
> No, it seems to work with just the -release flag.
>
> The Python programmer in me hates the inconsistency between 
> these two, but it's fine.

I think it's for the better. The trouble with including keywords 
in the language is that it encourages their use. For example, 
there was once a suggestion to add a "namespace" keyword to the D 
language simply for the sake of linking with C++. There was a 
huge backlash because of the reason I stated before. I think the 
same philosophy applies here; we shouldn't add a "release" 
keyword because it would encourage it's use.

But why not encourage it? Because debug builds are for testing 
and, well, debugging your code. However, if there is 
"release-only" segments of code, then these are excluded from 
debug builds and so don't receive the same extensive testing and 
error checking as all other code. On the other hand, there are 
those corner cases when you actually need this which are 
adequately covered by the "version(release)" statement.

In summary, from a software engineering perspective, this is a 
bad idea in general and should be avoided wherever possible.


More information about the Digitalmars-d mailing list