Repository navigation
Conversation
Gate all Foundation usage behind a new, default-enabled `Foundation` trait, mirroring swift-dependencies. With default traits disabled, Parsing no longer links Foundation (or ICU) on non-Darwin platforms. * `Data`, `JSON`, `UUID` and `CharacterSet` conversions/parsers, and `Data: PrependableCollection`, require the trait. * `ParsingError` only formats `LocalizedError` via `localizedDescription` with the trait, and otherwise falls back to `"\(error)"`. * Format style parsers require the trait in addition to Apple platforms. * `Many` imports the platform C library for `memcmp` instead of Foundation. * Drop unused Foundation imports from `BinaryFloatingPoint` and `Identity`.
Member
|
Hi @ph1ps, thanks, this does seem like a good change to make! Will take a look soon. I'm also realizing that we should at least build the library with traits off to make sure things are good. That wasn't such a big deal for the CasePaths trait since it's mostly self contained, but it may be more important for a Foundation trait. |
Run the macOS and Linux jobs over a matrix of no traits, each trait on its own, and all traits (the default), like swift-sharing. Also only import CasePaths in the JSON benchmark when the `CasePaths` trait is enabled, which previously broke builds with default traits disabled.
Author
|
@mbrandonw Added the trait tests + small correction in the benchmarks, the configuration is most similar to the one you have in |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello,
I recently had the need for Foundation-less parsing and printing, to have minimal binary size impact for WASM & Android. This follows a similar pattern to what you guys have gone with in swift-dependencies.
The majority of changes should be straight forward except
localizedDescription. It introduces runtime differences when either enabling or disabling the trait rather than hiding/showing API which is a bit odd, but not sure if there is a way around that, but definitely open to feedback here.Thanks.