-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
rename std.os to std.posix #5019
Comments
why do we want the |
Is there merit to having a OS agnostic library, which makes calls into posix and window libraries? That way most programmers can write OS agnostic code, and standard library writers can focus on how to implement that code using both posix and windows sub-libraries? |
All of the std lib is OS agnostic except what is namespaced under |
|
@andrewrk might correct me here but I guess |
@kubkon I know I am no authority when it comes to stuff like this but I don’t really think trying to emulate POSIX behaviour on non-POSIX platforms is a good or a preferable thing. It might make it easier in someways but mostly towards one group. I have noticed over the last 10-15 years with all these new languages popping up that most of these languages are primarily developed by people that use Linux or a different Unix-like operating system. Which of course means that a lot of the interfaces, apis and tooling are heavily focussed on POSIX ideas of how things work and should work. This brings some annoyances to users on operating systems like Windows where things just work differently. I have seen it happen in Go, Rust, the filesystem api in C++ and even in some places in Zig. |
Emulating POSIX behavior on non-POSIX platforms is not an explicit goal of the Zig standard library. We have first-class Windows-specific API, as well as first-class Windows support in the main cross-platform abstractions. The POSIX API layer is mostly an implementation detail that seems reasonable to expose as a public API. I say implementation detail, because many systems have the exact same POSIX API, and so the main cross-platform abstractions look something like:
As you can imagine the top half of that if statement is often Windows. Now, consider something simple like Anyway, as far as your concerns for Windows not being taken into account for designing the main cross platform API abstractions, I share your concerns. And I am guilty of using Linux as my main dev workstation, although I do have a dedicated Windows laptop and a dedicated macOS laptop. Zig's main cross platform abstractions ( |
How will this affect BYOOS integrations? Will we be exporting |
BYOOS integrations need some reworking. Right now they are not even at the posix abstraction level- they are at the same layer as libc (which is problematic). I think we need to reevaluate the best way to satisfy the BYOOS use case and improve the way integration works. It's possible that looks like exporting root.posix rather than root.os but it may be worth considering even another option (which I haven't thought of yet). |
This isn't a very important detail, but I think it should be named |
Un-accepting for reconsideration in light of #6600 |
A name anything like std.cross.os, std.cross, std.os.cross shows better intention, if its design is posix, windows or a zig one is a detail. |
Thanks, I find |
std.os.windows
and similar will remain the same, but everything else, e.g.std.os.write
would becomestd.posix.write
.The text was updated successfully, but these errors were encountered: