You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLStyleLayer properties should be null_resettable or nonnull #6126
As of #6076, all the layout and paint properties on MGLStyleLayer subclasses are marked as nullable, but nil has an implicit meaning that we describe in documentation comments. Relying on documentation to assign a meaning to nil is fragile. Now that #6124 has landed, MGLStyleLayer properties should be either null_resettable or nonnull. null_resettable is pretty rare among Cocoa APIs, but nullable with an implicit meaning assigned to nil is even rarer.
On the plus side, the default behavior with null_resettable is easier to document and intuit, and we could even potentially change many NSNumber- and NSValue-typed properties back to primitive integers and enumerations, depending on how #5970 shakes out. (If we do go back to primitive types, we’ll need to use assign semantics, which precludes null_resettable behavior.)
On the other hand, the SDK will be unable to distinguish between an unset property and one that happens to be the default. Any attempted serialization from MGLStyleLayers to style JSON would be lossy, but it isn’t clear to me that this contrived use case would outweigh the benefits.
👍 I'm for using null_resettable and removing the fragile documentation. It is hard for me to imagine that the edge case of needing to distinguish between unset and default will matter very often at the SDK level.
Activity
boundsj commentedon Aug 24, 2016
👍 I'm for using
null_resettableand removing the fragile documentation. It is hard for me to imagine that the edge case of needing to distinguish between unset and default will matter very often at the SDK level.1ec5 commentedon Aug 26, 2016
Also note the affect the nullability qualifiers will have on Swift:
nullablemeans optionals all over the place and therefore lots of question marks or (unsafe) exclamation marks all over client code.null_resettablemeans implicitly unwrapped optionals all over the place but clean (and safe) client code.nonnullmeans clean headers and clean client code, at the cost of convenience when resetting properties.[ios, macos] Mark MGLStyleLayer properties null_resettable
[ios, macos] Mark MGLStyleLayer properties null_resettable