February 12, 2009
Walter Bright wrote:

> 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".

GDC uses the same GNU triplets as GCC and configure, with the "os" part.
(there's normally a cpu part, a vendor part, and a gnu part for linux)

So the version used would be similar to the powerpc-apple-darwin8 or
i686-apple-darwin9, or any of the other common variants on Mac OS X ?

Like powerpc-unknown-linux-gnu and i686-pc-linux-gnu for Linux, it is
usually the same as the uname(1) but in lower case (see config.guess)

http://cvs.savannah.gnu.org/viewvc/*checkout*/config/config/config.guess


These GNU triplets are also used when cross-compiling, for instance...
They're not identical to the GDC versions, but I prefer using "darwin".

The other common version(Unix) ones were:
linux, darwin, cygwin, freebsd, solaris

--anders


PS. uname(1) on cygwin is somewhat weird, like "CYGWIN_NT-5.1" or so.
    And I think Solaris still returns "SunOS" for the system name...
February 12, 2009
Walter Bright wrote:

> 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".

Once upon a time, there was a difference between Darwin and Mac OS X.

Where Darwin was the underlying (open source) operating system, but
excluding the (proprietary) frameworks such as Carbon and Cocoa...
So you had two: Darwin OS and Mac OS X. And both of them were "Darwin",
so the term "puredarwin" was being used to refer to the open source OS.

If you only target the vendor product, and not the open source one,
then it doesn't really matter whether "Darwin" or "MacOSX" is used.
(or "OSX", which includes both iPhone OS and Mac OS X in one term)
Like you mentioned, GCC only predefines __APPLE__ and __MACH__...

Now, I still hate the term "OSX" but that's without technical reasons.

--anders


PS. See also http://en.wikipedia.org/wiki/Darwin_(operating_system)
February 13, 2009
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.
February 13, 2009
"Jacob Carlborg" <doob@me.com> wrote in message news:gn49b6$49b$1@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++.


February 14, 2009
Nick Sabalausky wrote:
> "Jacob Carlborg" <doob@me.com> wrote in message news:gn49b6$49b$1@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


/Jacob Carlborg
February 14, 2009
"Jacob Carlborg" <doob@me.com> wrote in message news:gn693c$14de$1@digitalmars.com...
> Nick Sabalausky wrote:
>> "Jacob Carlborg" <doob@me.com> wrote in message news:gn49b6$49b$1@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.


February 14, 2009
Nick Sabalausky wrote:
> "Jacob Carlborg"<doob@me.com>  wrote in message
> news:gn693c$14de$1@digitalmars.com...
>> Nick Sabalausky wrote:
>>> "Jacob Carlborg"<doob@me.com>  wrote in message
>>> news:gn49b6$49b$1@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.
>
>
I'm no Mac user but it seems to me that OS X is a superset of darwin (i.e darwin plus apple's proprietery APIs like cocoa, carbon).
if that's true isn't it more acurate to have version darwin for the darwin OS (someone mentioned opendarwin), and osx version for Apple's Mac OS X in addition to darwin version? i.e Mac OS X is both "osx" and "darwin" whereas opendarwin is only "darwin".
does that make sense?

February 14, 2009
"Yigal Chripun" <yigal100@gmail.com> wrote in message news:gn76f3$big$1@digitalmars.com...
> I'm no Mac user but it seems to me that OS X is a superset of darwin (i.e
> darwin plus apple's proprietery APIs like cocoa, carbon).
> if that's true isn't it more acurate to have version darwin for the darwin
> OS (someone mentioned opendarwin), and osx version for Apple's Mac OS X in
> addition to darwin version? i.e Mac OS X is both "osx" and "darwin"
> whereas opendarwin is only "darwin".
> does that make sense?
>

*Seems* to make sense to me, but then again, I'm not a mac user either.


February 14, 2009
Yigal Chripun wrote:

> I'm no Mac user but it seems to me that OS X is a superset of darwin (i.e darwin plus apple's proprietery APIs like cocoa, carbon).
> if that's true isn't it more acurate to have version darwin for the darwin OS (someone mentioned opendarwin), and osx version for Apple's Mac OS X in addition to darwin version? i.e Mac OS X is both "osx" and "darwin" whereas opendarwin is only "darwin".
> does that make sense?

Sortof, just that OpenDarwin/PureDarwin are normally "puredarwin"
while Mac OS X is "macosx" - both in addition to regular "darwin".

At least those are the "variants" that DarwinPorts/MacPorts uses,
Apple recommends to check for specific functionality (Carbon/Cocoa)
using something like autoconf and not assume things from the OS name.
But D could still do user-level versions of those features, though ?

In MacPorts, the toggle for +puredarwin/+macosx is a simple Tcl check:
[file isdirectory /System/Library/Frameworks/Carbon.framework]


But yeah, it would be nice if DMD could set *both* "version(darwin)"
and "version(OSX)" for Mac OS X. That way the old code would work too.

There would still be some library issues between Phobos and gPhobos,
like std.c.osx.osx verus std.c.unix.unix, but that's another story...

--anders
February 14, 2009
> But yeah, it would be nice if DMD could set *both* "version(darwin)"
> and "version(OSX)" for Mac OS X. That way the old code would work too.

... and it did. :-)

--anders