The requires_stored_property_inits and warn_unqualified_access attributes were recently added to The Swift Programming Language book (for Swift 4.2).
Are these attributes meant to be public? They haven't gone through Swift evolution AFAIK.
Cc: @Douglas_Gregor, @jrose
These were not meant to be public.
Doug
1 Like
I've created SR-8892 for updating the book.
Should requires_stored_property_inits and warn_unqualified_access also be made UserInaccessible in AST/Attr.def?
krilnon
(Kyle Murray)
5
These attributes can show up in arbitrary API documentation (like Sequence.min()) because they're not underscored. As a result, people reading API documentation might encounter them, so we added information about them to the attributes reference.
They predate SE-0001, so that makes sense.
I don't think it makes sense to change how they're documented until something about their implementation changes; whether that means prefixing them with an underscore, adding them to Attr.def, or Swift Evolution-ing them to camel case.
@krilnon If these attributes are documented, it may give the impression that they are safe to use in third-party APIs. Could you at least add a disclaimer that they are currently for internal use only?
I can look into prefixing them with an underscore, if their originators @Douglas_Gregor and @jrose agree.
1 Like
jrose
(Jordan Rose)
7
That would be source-breaking. I can't see why anyone would want requires_stored_property_inits, but warn_unqualified_access seems perfectly reasonable.
nuclearace
(Erik Little)
8
We have precedent for renaming modifiers that weren’t meant to be public. See @effects to @_effects
jrose
(Jordan Rose)
9
Yes, but _effects is incredibly unsafe (in the undefined-behavior-if-it's-wrong sense). warn_unqualified_access is something that people could reasonably be correctly using.
@jrose Could @warn_unqualified_access be made into an alias for @warnUnqualifiedAccess?
Similar to SE-0106 (with SR-1823 and SR-1887 in progress) for macOS and its OSX alias.
See also apple/swift#12674.
1 Like