www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - version(Posix)

reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Is there any way of getting a common version(Posix)
*before* D 1.0 is out ? Or are we stuck with using:

version (Windows)      private import std.c.windows.windows;
else version (linux)   private import std.c.linux.linux;
else version (darwin)  private import std.c.darwin.darwin;
else static assert(0); // unsupported platform

Besides for the system-specific modules, most of it
could probably be declared just once, in one module:
std.c.posix.posix; // to define the portable calls
(with "version" inside this one to import the others)


And then the code could just do a more easily portable:
version (Windows) { ... } else version(Posix) { ... }

Just to get rid of the usual "if Windows else linux" crap ?
(or, just as bad, using #if linux - meaning #ifndef _WIN32)

Having to copy and paste linux to darwin once is bad enough.
But having to do it for FreeBSD and Cygwin too is madness...


D is meant to be portable, right ? (beyond Win32 / Linux X86)
--anders


PS. And what happened with the "version (!Windows)" patch ?
     Sure looks a lot better than "version (Windows) {} else"
Feb 06 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anders F Björklund schrieb am Sun, 06 Feb 2005 20:25:52 +0100:

<snip>
 PS. And what happened with the "version (!Windows)" patch ?
      Sure looks a lot better than "version (Windows) {} else"
Guess that patch and commrades like HTML and "line ending" have gone to the digital hunting grounds. *g* Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCB3Qq3w+/yD4P9tIRAq21AKDSCYiPi/+oY45B0naebnooB9iq5ACgwrbz HrfQVmdwLcohNo0uTC7XzRA= =onjr -----END PGP SIGNATURE-----
Feb 07 2005
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Thomas Kuehne wrote:

PS. And what happened with the "version (!Windows)" patch ?
    Sure looks a lot better than "version (Windows) {} else"
Guess that patch and commrades like HTML and "line ending" have gone to the digital hunting grounds. *g*
Methinks they are not dead, just resting? Or pining for the fjords. --anders PS. But having a Bugzilla would be nice. A Version Control System too... It's sad when good suggestions and fixes goes to waste like that ? The current systems (Walter and David) are so easily overloaded :-)
Feb 07 2005