I think the underlying confusion stems from wondering how a person goes about introducing something behind a feature flag.
Can anyone do it? Like, can literally anyone just create their own flag and implement their own feature into Swift behind that flag, without going through Evolution?
Or is there some process for making that happen, and if so where is that documented and how does it work?
Swift's compiler development process tries to avoid longstanding complex feature branches; instead, we merge unreviewed features but gate them behind experimental-feature flags. I don't think we have a firm policy about this, but there's a general expectation that features being developed this way are simultaneously going through at least the pitch phase of the evolution process. (We do have a firm policy against adding unreviewed features that aren't gated behind experimental-feature flags â a policy which unfortunately was violated here, albeit inadvertently and (I think) harmlessly.)
Now, these features are definitely in the compiler, and they have not gone through evolution; but note that you can get the same effect by just forking the compiler source code to add a feature yourself. In either case, the feature is not really in the language because the project is not promising to support it in any way. Experimental features which no longer have a recognizable path to approval can and do simply get removed from the compiler, flag and all.
If I, personally, have an unreviewed feature, and I open a PR to add it to Swift, will the compiler development team accept that PR, gating the feature behind an experimental flag?
Or is there some other process that I would have to go through to request permission to create such a flag and feature?
Or is it only possible for individuals at Apple, or on the Swift Core Team, or in some other group, to take that route?
Itâs not reserved only for certain people. As code owners, we make a judgment call based on an informal assessment of the featureâs prospects and how much work it would take to maintain it as a branch for a few months. Sometimes the Language Working Group gets asked for their opinion on the first point.
If the feature is merged but doesnât seem to be making progress, it may be removed. For what itâs worth, that has happened to work by Apple engineers.
Again, this is all development process, not evolution process. Is there a reason youâre interested in this?
@John_McCall hmm⌠an out-of-the-box c++ style aggregate initialization support for simple swift structs? is there anyplace i can follow along for any more developments on that? thanks!
Since the macro did not make it into the standard library, there is a solution for those interested in using it now. @EnumOptionSet is the comprehensive implementation of the variant based on the enum (aka SwiftUI style). The simplest form:
@EnumOptionSet
enum ShippingOption {
case nextDay, secondDay, priority, standard
}
It supports many suggestions discussed in this thread, including custom raw value types with overflow checks (both compile-time and runtime). See full documentation on GitHub.