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 upRefactor `std` to improve ease of porting #1
Comments
This comment has been minimized.
This comment has been minimized.
panicbit
commented
Mar 7, 2018
•
That is quite dated by now. I've tried a new approach which is a lot more straight forward and less idealistic. It will allow for a "mock" platform in the shape of the The current hurdles for a PAL in the form of traits are: |
jethrogb
added
the
std
label
Mar 7, 2018
This comment has been minimized.
This comment has been minimized.
|
As I mentioned a bit on IRC, I would propose these 3 parallel first steps:
(Besides this issue, I think we can also also get started on #5 immediately, and in total parallel to this.) |
This comment has been minimized.
This comment has been minimized.
|
I actually think these are all orthogonal to this issue. The things you bring up make it easier to use things from |
This comment has been minimized.
This comment has been minimized.
panicbit
commented
Mar 16, 2018
|
@jethrogb Well, the abstract_platform approach is all about being able to use things from |
This comment has been minimized.
This comment has been minimized.
|
@panicbit beat me to it :). |
This comment has been minimized.
This comment has been minimized.
panicbit
commented
Mar 16, 2018
•
|
@Ericson2314 Indeed, the only platform-dependent use I could find was in a test in sys_common/net.rs |
This comment has been minimized.
This comment has been minimized.
|
As to fallible allocation, I can sort of squint at to make a concern for us. On certain platforms, fallible allocation is the only one that makes sense, so its sort of a policy-portability concern. Then, insofar that I moved it below |
This comment has been minimized.
This comment has been minimized.
|
I see, these changes are necessary to deal with the dependency inversion problem. |
Ericson2314
referenced this issue
Mar 16, 2018
Open
Tracking issue for location of facade crates #27783
This comment has been minimized.
This comment has been minimized.
clarfon
commented
Mar 16, 2018
|
IMHO trait aliases make something like |
This comment has been minimized.
This comment has been minimized.
|
@clarcharr That would be really cool, but impl<T: core::io::Write<Err = !>> core::hash::Hasher for T { .. }which wouldn't work if both were trait aliases (but maybe it's if just one is!). [Side note, in my previous attempt at this, I also changed some signatures to better reflect how some of the methods treat "end of file" as an error, and some return |
This comment has been minimized.
This comment has been minimized.
clarfon
commented
Mar 16, 2018
|
@Ericson2314 That might be possible with some version of rust-lang/rfcs#2315, or if |
jethrogb
referenced this issue
Mar 24, 2018
Closed
we could implement same function for different target by cfg #15
This comment has been minimized.
This comment has been minimized.
lygstate
commented
Mar 24, 2018
•
|
So we reverse the dependencies? |
This comment has been minimized.
This comment has been minimized.
lygstate
commented
Mar 24, 2018
This comment has been minimized.
This comment has been minimized.
|
@jethrogb So what's next? Do we formally decide on a plan and if so how? |
This comment has been minimized.
This comment has been minimized.
|
Oh uh I liked your ideas in #1 (comment) and am not seeing any negative thoughts about it here, so I'd say we go for that. Unless you think we need a more formal process? |
This comment has been minimized.
This comment has been minimized.
|
@jethrogb glad you like it! Repeating what I belated replied with on IRC:
I'll add that while I suppose the main RFC process would still drill down on the technical merits of the proposed change, the vetting is especially good for making sure the motivation is meaningful and proposed change is palatable to the relevant stakeholders. That could allow the technical merits to be evaluated in isolation without spending lots of time ramping everybody up on the larger context. But anyways, enough speculating, @aturon what you intend us to do? |
This comment has been minimized.
This comment has been minimized.
|
I was expecting a lot of changes from the WG to not require RFCs since they don't change the publicly-visible API that |
This comment has been minimized.
This comment has been minimized.
|
@jethrogb Ah good point that's true too. But then might it be even more important we formally plan something, since there's no other decision making in those cases? In the past a lot of big refactors stalled because it wasn't clear who should merge/review and they bit-rot quick. Getting a head count on people willing to help maintain the PR + some sort of prior commitment on reviewing/merging could be important to keep our momentum going better than in the past. |
jethrogb commentedMar 7, 2018
•
edited by Ericson2314
Currently,
stdcontains platform-specific code throughout. This makes bothin-tree and out-of-tree ports harder. In-tree ports are harder because it's not
obvious what all needs to be implemented. Out-of-tree ports are harder because
they require frequent laborous rebasing due to an unclear interface. It's not
possible to port just a little bit to get your platform started, because
succesful compilation requires “everything” to be there.
The idea is to add a platform abstraction layer (PAL) to
stdto separateout platform-specific code from generic code. The exact shape of the desired
interface is unclear. The refactoring will likely need to be an incremental
process where the PAL interface gets more cleary defined step-by-step.
As part of this work, it should be possible to create a "mock" platform that
can be used to test the interface and as a starting point for implementing new
platforms.
Prior work: