Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upPlan for cleaner seperation of libstd facade and implementation #2
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
panicbit commentedFeb 3, 2018
•
edited
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
platformmay be made.To allow a smoother transition, this will be implemented completely inside of
::sysat 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
::extvia a platform specific contract.This crate needs to take care not to export any items except
::Std(which needs to implementabstract_platform::traits::Std), required statics and an optionalextmodule.::Stdmust be either an empty struct or an empty enum.