Why version() ?

Nick Sabalausky a at a.a
Sat Feb 14 10:45:50 PST 2009


"Jacob Carlborg" <doob at me.com> wrote in message 
news:gn693c$14de$1 at digitalmars.com...
> Nick Sabalausky wrote:
>> "Jacob Carlborg" <doob at me.com> wrote in message 
>> news:gn49b6$49b$1 at digitalmars.com...
>>> Walter Bright wrote:
>>>> Anders F Björklund wrote:
>>>>> Walter Bright wrote:
>>>>>
>>>>>>> OSX is the new name for Apple's OSes: Mac OS X and iPhone OS.
>>>>>>>
>>>>>>> And of course DMD can use anything, but GDC uses darwin/Unix.
>>>>>> Apple can't seem to make up their mind. uname does return "Darwin". 
>>>>>> gcc predefines "__MACH__" and "__APPLE__", but neither darwin nor 
>>>>>> osx. The documentation all says osx.
>>>>> Will you set version(darwin) though, or would that be "version(osx)" ?
>>>>>
>>>>> The existing D code for Mac OS X all uses version(darwin) from before.
>>>> version(OSX)
>>>>
>>>> I just don't think darwin is a good idea, as Apple doesn't even use it. 
>>>> See http://developer.apple.com/unix/index.html, where "darwin" is 
>>>> clearly second string. It looks like Apple is pushing aside "darwin" in 
>>>> favor of "OSX".
>>> I'm not going to argue about what is the best version identifier for Mac 
>>> OS X, the I only thing I care about is consistency and "darwin" is 
>>> already used by LDC and GDC. Don't make things harder.
>>>
>>>> Fortunately, (darwin) => (OSX) is a trivial global search/replace.
>>> And I assume it's equally trivial to implement "darwin" as the version 
>>> identifier. Again, don't make things harder by breaking existing code.
>>
>> I don't have an opinion on the correct identifier to use, but not 
>> implementing a change that makes something more correct *just* because it 
>> breaks existing code (particularly in an easy-to-fix way) is a terrible 
>> strategy. That's exactly what's turned C++ into the abysmal mess that it 
>> is today, which in turn is one of the primary reasons for D's existence. 
>> I don't want to end up with yet another C++.
>
> I guess I have to start to argue. In this case I don't see that some 
> version identifier is more correct than the other, you just have to make a 
> choice. Either you choose to be as close to the official name of the 
> operating system as possible, in this case I guess it should be "Mac OS 
> X". Or you choose the uname that I've seen some people here talk about or 
> a part of the target triple or what it's called, for example 
> i386-apple-darwin. Then there's the question about upper/lowercase and 
> spaces in the name. Or any other suggestions.
>
> I have know idea what the initial thought was when Walter chose the 
> version identifiers and therefore I have no idea what would be the most 
> correct version identifier to choose in this case.
>
> Because of gdc and ldc already use "darwin" you have to make a special 
> case for dmd. Of course they could change the version identifier but at 
> least for gdc I don't see that's very likely. GDC seems quite dead but 
> it's still the most reliable compiler for Mac OS X at this point. I have 
> no problem using dmd when it becomes equally reliable on Mac OS X as on 
> linux/windows but as far as I know it will only be for x86 and there are 
> three other targets for osx (excluding iphone): x86-64, ppc and ppc64.
>
> So what is the most correct version identifier? I don't know. But I think 
> you should choose one option form the beginning and then try to be as 
> consistent as possible.
>
> I guess I have to add this to every dsss file:
>
> version (DigitalMars)
> version (OSX)
> version = darwin
>
>

I see what you're saying. In that case, perhaps the best thing to do is, for 
now, keep it as something that's consistent across all D compilers, and then 
once GDC is finally made *completely* obsolete by combined effort of LDC and 
DMD (or revived by someone brave enough to dig into the gcc code), then we 
could make it whatever seems to be most accurate. 





More information about the Digitalmars-d mailing list