If the version for Windows is going to be capitalized, then the version for Linux needs to be capitalized too.
I recommend deprecating version(linux) and adding the default version(Linux). By deprecate I mean just remove it from the documentation and allow it to gradually be forgotten.
Maybe someone was under the impression that "Windows" is a proper name, but "linux" is not, however, Googling for "linux" turns up many many uses of the name capitalized. In particular sites that should know seem to capitalize it, like linux.org: http://www.linux.org/info/index.html
Comment #1 by larsivar — 2008-04-21T16:40:15Z
Also, uname gives Linux, which tends to be the source used for scripted and programmed checks for the OS. uname on FreeBSD returns freebsd for instance, which turns out to also be the version identifier for that OS in GDC.
This would allow for things like
./gdc -fversion=`uname`
Comment #2 by afb — 2008-04-21T17:49:53Z
(In reply to comment #1)
> Also, uname gives Linux, which tends to be the source used for scripted and
> programmed checks for the OS. uname on FreeBSD returns freebsd for instance,
> which turns out to also be the version identifier for that OS in GDC.
No, the uname on FreeBSD returns "FreeBSD" and the uname on Mac OS X returns "Darwin". The version identifiers are lower-cased for all of the systems, with the common pre-defined definition in GDC being version(Unix) which matches version(Windows). Unfortunately, DMD is missing "Unix" and only has "linux".
See http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/Version
> This would allow for things like
>
> ./gdc -fversion=`uname`
Why would you need this ? It's built-in anyway... But it's used for Makefile inclusions in wxD, for instance. So it comes in handy once in a while. The definitions for MinGW and Cygwin are rather ugly, though. (includes version and is upper-case, looks something like "MINGW32_NT-5.1" or "CYGWIN_NT-5.1")
Anyway, the whole issue was brought up years ago (2005) and should be a WONTFIX. See for instance http://www.digitalmars.com/d/archives/digitalmars/D/37778.html#N37933 and http://www.digitalmars.com/d/archives/D/gnu/1208.html.
Comment #3 by wbaxter — 2008-04-21T18:41:26Z
(In reply to comment #2)
> Anyway, the whole issue was brought up years ago (2005) and should be a
> WONTFIX. See for instance
> http://www.digitalmars.com/d/archives/digitalmars/D/37778.html#N37933 and
> http://www.digitalmars.com/d/archives/D/gnu/1208.html.
Those threads are mostly about getting DMD to predefine Posix or Unix. That's not what this bug is about. This is about the capitalization of "Linux" being inconsistent, and that's it.
The second thread does include this rationale for "version(linux)" from Walter:
"""
The reason DMD uses "linux" is because gcc under Linux predefines "linux".
"""
http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=D.gnu&artnum=1240
I have no idea why DMD should define its Linux version identifier based on GCC's behavior, rather than doing something consistent and which makes sense for D. But even if for some bizarre reason people feel that D's versions should follow the conventions of #defines established by some particular implementations of C, there's still an inconsistency, because the preprocessor symbol predefined on Windows systems is not "Windows" or "Win32", but rather "WINDOWS" or "WIN32" or "_WIN32".
Comment #4 by afb — 2008-04-22T01:30:05Z
My point was just that "version(Windows)" and "version(Unix)" already have a consistent capitalization in the portable compiler.
And "version(linux)" and "version(darwin)" and "version(cygwin)" and "version(freebsd)" and "version(solaris)" do too.
Comment #5 by wbaxter — 2008-04-22T01:41:55Z
I see. I agree that's a reasonable and well thought out way to make everything consistent.
Comment #6 by bugzilla — 2008-04-22T20:29:21Z
As has been pointed out in the comments, "linux" is used because that is the way gcc on Linux defines it. There isn't any consistent way to do it, so might as well just use what the Linux programmers are used to using.
Comment #7 by wbaxter — 2008-04-22T20:48:11Z
Still seems kind of silly to me.
First because this is D -- why should a D user be expected to have any knowledge of how GCC usually behaves on Linux.
And second because I think you'd be the first to agree that the way preprocessor symbols are defined in C/C++ is totally fubar and inconsistent. Why perpetuate a broken system?
That said, the way GDC does it, as AFB pointed out, takes the lemon that is DMD version names, and makes lemonade, by repositioning "linux" as a subcategory of "Unix". It would definitely be nice if DMD would pick up this idea and add a "Unix" version.
Comment #8 by wbaxter — 2015-06-10T01:34:12Z
Ah, this reminds me of the old days when I was working in D every day and spending far too much time arguing about D issues.
I think this comment thread sums up pretty well my ambiguous relationship with D. So wonderful in so many ways, but it always felt like I had a fundamentally different notion about what it meant for software to be beautiful than Walter did. I think what I want above all is simplicity, order, and logical, consistent design. To me that makes a language beautiful (with performance of course). What Walter seems to want above all is something that gets the job done easily, without too much complexity. It seems to be a much more pragmatic take than mine. To me a silly inconsistency like this sticks out like a big scratch on a beautiful Ferrari. Just take it to the shop and fix it already!
__traits is another example. For such a core feature, it deserves a non-ugly name.
And then there's "is" which has a nice clean name, but whose usage syntax is totally wacky. I have no idea what "is ( Type Identifier : TypeSpecialization , TemplateParameterList )" means. Example from the http://dlang.org/expression.html:
"static if (is(Tup : TX!TL, alias TX, TL...))"
it starts to look a little like Perl, really.