-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjustments to std.system. #186
Conversation
static assert(0); | ||
} | ||
/// The family of OS that the program was compiled for. | ||
version(StdDdoc) Family family; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Family family;
is equals to Family family = Family.win32;
. Is it expected behaviour? Is so, why win32
is set to 1
insted of default 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notice the StdDdoc
. That declaration is only for the documentation. Its value doesn't matter. It'll never actually be used in code. version(StdDdoc)
is used so that it'll show up no matter which system is used to generate the documentation without having to duplicate the documentation for every version
block.
As to why win32
is 1
, I don't know. I didn't change its value. It was that originally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so, as it shouldn't be used, variable cannot be read at compile time error
is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@denis-sh: No, you are getting this wrong – the declaration is only used if the Phobos documentation is built (the StdDdoc
is set). During normal compilation, it has no effect.
@jmdavis: Are you sure the extra DDoc version is actually required? As far as I know, a DDoc comment always affects the next declaration, and as version
ed out ones are just skipped…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. I'm pretty darn sure that when you have
/// ddoc comment
version(Windows) code
else version(linux) code
you don't get the documentation on Linux, but it could be that the code that I dealt with before which had that problem before was actually
version(Windows)
{
///ddoc comment
code
}
else version(linux) code
At this point, other places in Phobos (e.g. std.file) use this scheme when they have to version code like this. I'd have to experiment with it though to be 100% sure that the first example doesn't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmdavis: I just checked and just placing the documentation outside the version block seems to work for me – are there any cases where it breaks? I'm aware that this scheme is used in other places, but I think we should avoid StdDdoc
as much as possible.
Okay. In light of the issues with |
I think the main question here is about how much code this will break. |
Very little, I would think, since most of this module has been completely undocumented. Changing |
Sounds good, thanks. Please rebase? |
Okay. I redid it all as one commit on the latest master. I didn't add the duplicate values for |
Still can't merge for some reason. |
Conflicts: std/format.d
This pull request makes a couple of small changes to std.format (since it uses |
add changelog from directory builder
I went in to fix the enum values so that they followed the Phobos naming conventions and ended up trying to clean it up a bit and make it more complete. Honestly though, I'm not sure how much of std.system is truly useful. I'm very tempted to remove the
os
variable at the bottom as well asos_major
andos_minor
- none of which have been documented. There's no way thatos
will ever be correct in the general case. It might be able to be made to work on Windows but not on any Posix system - especially if we go beyond the basic Linux, OSX, FreeBSD to be more specific (andOS
has hadRedHatLinux
in it, so it's obviously intended to be more specific on more than just Windows). So, honestly, I'd be tempted to axe theOS
enum entirely.Family
serves about the same purpose asEndian
- it gives runtime versions of theversion
values - so they're both of some value, butOS
seems far less useful to me. I did expand it to be more thorough, but I'd honestly rather outright remove it. Its main purpose seems to be to be used in conjunction with theos
variable to indicate which OS you're currently running on, and I just don't see how that is generally feasible.