Thoughts on std.system.OS
Jonathan M Davis
jmdavisProg at gmx.com
Sat Aug 13 16:47:21 PDT 2011
On Saturday, August 13, 2011 22:08:36 Vladimir Panteleev wrote:
> On Sat, 13 Aug 2011 20:16:52 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
>
> wrote:
> > As for doing something like you suggest with the os_major and os_minor
> > numbers, it does seem kind of messy. If all you want is comparison, you
> > can do
> > that with the existing enum, and it covers all of the Windows versions
> > that
> > most people will care about.
>
> Please, no. Ignoring server Windows versions is a huge mistake, and their
> version numbers go in the same pace as the client ones.
>
> Personally, I don't think that distro detection belongs in Phobos. It
> seems way too undocumented and unstandardized.
Which is part of why I brought up the idea that perhas std.system shouldn't be
doing what it's trying to do. If it can't do it right, it shouldn't do it all.
> > As for doing something like you suggest with the os_major and os_minor
> > numbers, it does seem kind of messy.
>
> I think it's less messy than pretending that all but certain popular
> Windows versions don't exist.
>
> What about the dynamic array idea for version number representation and
> comparison? Would that work? It seems to me like a nice clean solution.
If we can't do this for all of the OSes, I don't see much reason to have it in
std.system. Something could be put in std.windows, but it seems to me that the
only place that this functionality is of much value is in comparing versions
of Windows (and maybe comparing the versons on the Mac) to determine some
level of compatibility or somesuch.
In core.sys.windows.windows, you have the windows system call GetVersion.
_That_ is probably what should be used to determine versions on Windows, and
maybe it should be wrapped, but that would be a Windows thing. Personally, I'm
inclined to drop the Os enum along with the os and os_major and os_minor
variables, because I just don't think that we can get them to be correct
enough of generally useful enough to be worth having. It's too OS-specific to
be trying to handle it in an OS-generic manner like that.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list