www.digitalmars.com         C & C++   DMDScript  

D.gnu - Unix vs. Posix again (version)

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Are there any GDC plans to change from the
current "Unix" version, to Posix instead ?

I think Win32 and Posix makes more sense here,
than what Windows and Unix does ? (API vs OS)


Or should it be redundant here too, and have
both Unix and Posix just like it has both of
Windows and Win32 now on that other platform ?

Maybe I am wrong and it doesn't matter, and
we should just stick with what we have now,
i.e. version(Windows) and version(Unix) ?


Anything's better than DMD's "linux", though...
(nothing wrong with GNU/Linux, just that it
gets a bit tedious for all 5+ GDC platforms)

Too bad that Walter is not interested in this.
(the linux/Unix fixes *really* belong upstream,
which would make the mainstream D more portable)

--anders
May 04 2005
next sibling parent reply John Reimer <brk_6502 yahoo.com> writes:
Anders F Björklund wrote:
 Are there any GDC plans to change from the
 current "Unix" version, to Posix instead ?
 
 I think Win32 and Posix makes more sense here,
 than what Windows and Unix does ? (API vs OS)
 
 
 Or should it be redundant here too, and have
 both Unix and Posix just like it has both of
 Windows and Win32 now on that other platform ?
 
 Maybe I am wrong and it doesn't matter, and
 we should just stick with what we have now,
 i.e. version(Windows) and version(Unix) ?
 
 
 Anything's better than DMD's "linux", though...
 (nothing wrong with GNU/Linux, just that it
 gets a bit tedious for all 5+ GDC platforms)
 
 Too bad that Walter is not interested in this.
 (the linux/Unix fixes *really* belong upstream,
 which would make the mainstream D more portable)
 
 --anders
I think Posix should be preferred. But good luck getting a consensus on that here. It hasn't worked for awhile. Even if you do get a consensus, I wonder if anything will be done about it. Probably not, because no one really has any authority to enforce the consensus. :-P -JJR
May 04 2005
parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
John Reimer wrote:

 I think Posix should be preferred.  But good luck getting a consensus on 
 that here.  It hasn't worked for awhile.  Even if you do get a 
 consensus, I wonder if anything will be done about it. Probably not, 
 because no one really has any authority to enforce the consensus. :-P
It's not *that* bad, as you make it sound... There's two alternatives here, either "we" keep it as Unix, or it is changed into Posix (like Mango uses, currently...) But since Walter seems to be dead set on "sorting" it on OS, perhaps Unix is a better match - for Windows and linux [sic] ? Not to mention that it would be less (search/replace) work for David, who could probably find something more fun to do. :-) But it should probably be: "std.c.unix.unix", instead of std.c.unix (like it is in GDC 0.11) ? So we would end up with something like this: version (DigitalMars) { version (Windows) import std.c.windows.windows; else version (linux) import std.c.linux.linux; else static assert(0); } else version (GNU) { version (Unix) import std.c.unix.unix; else static assert(0); } else static assert(0); Still have to replace "linux", as used by DMD. (std.c.darwin.darwin is on the way out, as well - at least for the Posix stuff common to all Unix) Hmmm, Maybe one could use Posix as the "alias" for both ? version (Windows) { private import std.c.windows.windows; } else version (Unix) // for GDC { version = Posix; private import std.c.unix.unix; alias std.c.unix.unix posix; } else version (linux) // for DMD { version = Posix; private import std.c.linux.linux; alias std.c.linux.linux posix; } And then just use: version(Posix) { posix.whatever; }, instead of having to make two: one for each D compiler ? (or in the worst case, one for each operating system - as it looked it was going to end up there for a while!) I'm not sure there's anything that can be done about DMD ? So far it hasn't even been able to *spell* Linux properly... --anders
May 04 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Anders F Björklund" <afb algonet.se> wrote in message
news:d5air3$20eh$1 digitaldaemon.com...
 I'm not sure there's anything that can be done about DMD ?
 So far it hasn't even been able to *spell* Linux properly...
The reason DMD uses "linux" is because gcc under Linux predefines "linux".
May 12 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Walter wrote:

I'm not sure there's anything that can be done about DMD ?
So far it hasn't even been able to *spell* Linux properly...
The reason DMD uses "linux" is because gcc under Linux predefines "linux".
I know. (or predefines "darwin", in my case... eg. "cygwin" for others) This has all been settled, and GDC will now use "Unix" for all of them. If you could make DMD define version(Unix) in addition to linux, great! It will also use etc.c.unix.unix, as a collective header for all POSIX. OS-specific things will be in etc.c.linux.linux / etc.c.darwin.darwin, if needed (but currently the autoconf takes care of *everything* in it) This removes the need for including five (or so) different OS modules... In theory, you can usually get away with just Windows and Unix versions. So: instead of version(linux), the code now uses version(Unix) And instead of "import std.c.linux.linux;", it imports unix. And (assuming that there were no Linux-only parts), it then works on other platforms too - such as Mac OS X or FreeBSD... For DMD, std.c.unix.unix could just import std.c.linux.linux ? --anders PS. Sorry for the bad attitude. Thanks for taking the time to read.
May 12 2005
prev sibling parent reply David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
Anders F Björklund wrote:
 Are there any GDC plans to change from the
 current "Unix" version, to Posix instead ?
 
 I think Win32 and Posix makes more sense here,
 than what Windows and Unix does ? (API vs OS)
 
 
 Or should it be redundant here too, and have
 both Unix and Posix just like it has both of
 Windows and Win32 now on that other platform ?
 
 Maybe I am wrong and it doesn't matter, and
 we should just stick with what we have now,
 i.e. version(Windows) and version(Unix) ?
 
 
 Anything's better than DMD's "linux", though...
 (nothing wrong with GNU/Linux, just that it
 gets a bit tedious for all 5+ GDC platforms)
 
 Too bad that Walter is not interested in this.
 (the linux/Unix fixes *really* belong upstream,
 which would make the mainstream D more portable)
 
 --anders
I'm not planning on changing Unix to Posix. I agree that there should be a way to describe what APIs are available. For example, I would like a clean way to use the Win32 APIs in Cygwin. "Posix" could be used as an API indicator. Maybe "Posix" shouldn't be in the class of predefined symbols. Someone may want to use 3rd-party Posix APIs on a non-Unix OS.. David
May 04 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
David Friedman wrote:

 Are there any GDC plans to change from the
 current "Unix" version, to Posix instead ?
[...]
 I'm not planning on changing Unix to Posix.
That's settled then. Onwards...
 I agree that there should be a way to describe what APIs are available. 
  For example, I would like a clean way to use the Win32 APIs in Cygwin. 
  "Posix" could be used as an API indicator.
version(cygwin) works, doesn't it ?
 Maybe "Posix" shouldn't be in the class of predefined symbols. Someone 
 may want to use 3rd-party Posix APIs on a non-Unix OS..
No, let's leave it at Unix for now. --anders
May 05 2005