-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib][Part 1] De-gyb almost everything #21149
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
Conversation
@airspeedswift and I just talked about this briefly. We'd like to do this, but want to be a bit more gradual about it. In particular, Ben wants to keep the In cases where there isn't too much duplication, removing gyb entirely makes sense, but we should do those one file-per-commit, I think. |
Understandable. I read "all in" from Ben and I was ready to go "all in" 😅 I imagine we might one day get around to de-gybbing |
@Azoy let's leave IntegerTypes and FloatingPointTypes alone for the time being, since they're a bit more involved than the others (but: we would simply run the test multiple times with different arguments to validate). I think the other thing worth doing here is to more clearly document how to generate the .swift files from the .swift.gyb (probably via a comment line at the top the .gyb file that has exactly the required invocation(s)). |
I'd rather leave them all in one big file than clutter the folder with lots of near-identical files. The goal of degybbing is to improve search ability of the source code (the "where on earth is xxx declared" question on the forum that led to this idea), to allow stepping through the std lib, allow an LSP server to parse the whole std lib etc, all of which works from the single file approach. These files are probably rarely going to be touched in future so making them easier to navigate/read for editing purposes isn't that important. |
I only bring up splitting them up because the gyb file itself is almost 2k LoC, and a single ungybbed |
@Azoy @airspeedswift Also worth noting that as the generics story and compiler optimizations get better, we can move progressively more and more integer stuff out of gyb and into default implementations, so the gyb piece will gradually get smaller. It should eventually be pretty much just the wrappers around |
We talked about this some more and I am won over to the idea of breaking up the files (though re the 20k, I am guessing that's mostly docs and maybe some day we'll have doc-deduplication built into the swift doc capabilities). But it'd be good if we can do it by putting them all in an IntegerTypes folder. |
While looking for gyb comments in |
@Azoy Could you rebase this one more time? |
2d52286
to
861e0f7
Compare
@CodaFi I've successfully rebased a years worth of commits! @airspeedswift @stephentyrone I know it's been a WHILE, but I would love another look to make sure this is good to go! |
@swift-ci please test |
Build failed |
861e0f7
to
c996619
Compare
Build failed |
@CodaFi sigh sorry bout that one... it should be good now. |
It happens. Let’s give it another go. |
@swift-ci please test |
Build failed |
Ignore the macOS result. There’s an infrastructure problem here. |
c996619
to
0a1c30e
Compare
@CodaFi I've rebased and now this should be ready. |
@swift-ci please test |
Build failed |
macOS failure unrelated? |
Ugh, infrastructure failure. Let's try again @swift-ci please test macOS platform |
Build failed |
Another infrastructure problem again? x) |
I think this one’s an actual failure
Suggests you might have changed the ABI surface of stdlib. |
The conformances of There's a comment in dump-module.swift which might be relevant:
|
@@ -61,6 +63,7 @@ set(SWIFTLIB_ESSENTIAL | |||
EmptyCollection.swift | |||
Equatable.swift | |||
ErrorType.swift | |||
ExistentialCollection.swift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't fix the test failure, but you could move ExistentialCollection.swift to the SWIFTLIB_SOURCES list (at line 210) if it isn't an "essential" source; and also change the copyright year of CMakeLists.txt (from 2018 to 2019).
0a1c30e
to
e3a4401
Compare
@benrimmington thanks so much for the help. |
@swift-ci please test |
Build failed |
Build failed |
@CodaFi all tests have passed! |
⛵️ |
See here: https://forums.swift.org/t/struggling-to-find-things-in-the-new-stdlib-for-5-0-e-g-where-is-addingreportingoverflow-implemented/18612/7
This is part 1 in a 4 part series.
This removes most
.gyb
files from the stdlib. Commits titledde-gyb ...
are the product of copying and pasting the de-gybbed version over. I have a post de-gyb formatting commit that cleans up some of the messy formatting from gyb.cc: @airspeedswift @stephentyrone @lorentey @xwu