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

Plan for cleaner seperation of libstd facade and implementation #2

Open
panicbit opened this Issue Feb 3, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@panicbit
Owner

panicbit commented Feb 3, 2018

There are 3 key crates in this plan: libstd, abstract_platform, and platform (e.g. platform_unix).

  • libstd links to the abstract_platform and a platform crate. Almost all libstd types wrap around their counterpart in abstract_platform, instancing them via the platform impl.
    This crate needs to make sure to only interact with the platform crate via the abstract_platform types, with the exception of statics and the ext module.
    No assumptions over any of the types provided by platform may be made.
    To allow a smoother transition, this will be implemented completely inside of ::sys at first.

  • abstract_platform provides traits deacribing the required types, functions and constants to be provided by a platform crate. Furthermore it provides almost all types of libstd but generic over the platform (using the aforementioned traits). Statics can't be generic, so they can't be formalized via a trait and thus need to follow an informal contract (probably described in the crate doc).

  • platform provides a platform implementation by implementing the traits and statics from abstract_platform.
    Platform specific extensions may be provided at ::ext via a platform specific contract.
    This crate needs to take care not to export any items except ::Std (which needs to implement abstract_platform::traits::Std), required statics and an optional ext module.
    ::Std must be either an empty struct or an empty enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment