C locale

"Luís "Luís
Fri Sep 27 19:18:51 PDT 2013


On Saturday, 28 September 2013 at 01:42:52 UTC, Walter Bright
wrote:
>> For the reason you mentioned earlier. If you are changing the 
>> OSX values, you'll
>> likely mess up the Windows ones.
>>
>> I've been at this for 30 years, and am quite fed up with the 
>> bugs from attempts
>> to save a few keystrokes. The practice of separating the os 
>> sections into
>> distinct ones has been a big win in reliability.
>
> And, of course, as you discovered, when they are defaulted they 
> are usually wrong, and they are wrong in a most pernicious, 
> hard to discover way. The code looks right, and may even sort 
> of behave itself. The only way you can tell if it's wrong is to 
> laboriously and tediously go through the system's .h files.

Sure, I think it was unwise to "default" the locale enums if the
values do not have standard definitions across all systems
(although I still thank Sean Kelly for the headers, without them
porting code would have been an even greater chore).

But the issue of version(X, Y) is not a case of default, it is
something where you say explicitly that you want the same code
for two explicitly stated systems, without having to copy-paste
the block of code for both systems.

You mention that one disadvantage of such construct is that it
will increase the probability of developers changing both X and Y
when they only want to change X. But with two version blocks (and
copy-pasted code) you increase the probability that you only
change X when you should change X and Y. And with version()
blocks that is even less likely to be noticed, because the code
only has to be syntactically correct.

My point here is not to argue against your choice for the
standard library. My issues of version(X, Y) arose in client code
(non-lib), where it seems to me that the second kind of bug is
probably more likely to occur than the first kind. So, I politely
ask, are you sure the language should not support something like
version(X, Y), for cases where developers think that it is a
better trade-off than multiple version() blocks?


More information about the Digitalmars-d mailing list