-
Notifications
You must be signed in to change notification settings - Fork 3
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
Make std
fully pluggable
#4
Comments
Speaking personally, now, if I squint, I see both ML-style modules and the portability lint as ways to make coarser-grained modules work better. For example, if every create has the same portability on every single item, one can sort of look at the dependency closure of a package to sort of see what the portability is. Likewise it's sometimes possible to avoid needing ML functors by a proliferation of helper creates (c.f inlining higher-order functions, like the function argument to This is perhaps the primary reason why I advocate for keeping |
@Ericson2314 do you want to write the text for this one?
@Ericson2314 taking a stab at it per @jethrogb's request:
Much the various abstractions in
std
require different implementations on different platforms. Currently, they are implemented for linux, windows, and macos in situ. The advantage of this is dispatch is fully static (done at compile time). The disadvantages of this isIt is not modular: it is often necessary to fork
std
to implement an additional platform, which ties one to a specific version of Rust with the costs of rebases. Even though the Rust team is willing to upstream ports ofstd
to obscure platforms, avoiding the rebase penalty, that work-around will never be totally sufficient because many of us want to develop the platform and thestd
port simultaneously (e.g.std
userland over kernel, orstd
directly against os-as-a-library).The interface is not checked: There is no automatic verification that the implementations present the same interface (at least the portion we wish to be the same).
As it turns out, these goals are fairly harmonious. As we better define the platform-specific "input interfaces" which are abstracted into
std
's "output interface", we get both the intended interface for platform-specific crate(s) that can live outside ofstd
, and a mechanism for enforcing that thestd
interfaces are maintained.The problem is a a fully perfect solution solution probably requires a lot of language work. The https://github.com/rust-lang/rfcs/blob/master/text/1868-portability-lint.md is needed when different parts of the same crate have different portability requirements, which at least will be the case with
std
itself but possibly also various platform-specific infra. [Imagine a general "Unix filesystem" implementation which is augmented with linux- or macos-specific functionality.] Also, if we need to "weave" together platform-specific and platform-agnostic functionality in increasingly complex (higher-order, in particular) ways, we will need a more expressive module system like ML's (read about "ML functors" if you are unfamiliar with this.)Historically, our biggest problem in solving this are that
Taking a step back, requirements are
The text was updated successfully, but these errors were encountered: