[swift-evolution] Proposal: Stored properties in extensions
Paul Young
paulyoungonline at gmail.com
Sat Dec 5 20:01:11 CST 2015
There was some discussion about this recently on Twitter: https://twitter.com/jckarter/status/664257829633568768
On Sun, Dec 6, 2015 at 12:44 AM, Jacob Bandes-Storch via swift-evolution
<swift-evolution at swift.org> wrote:
> Sometimes it's desirable to break up a type's implementation into multiple
> files, within the same module. So for this simple case, it make sense for
> stored properties to be allowed (within the same module), treating them as
> continuations of the original class/struct declaration with no additional
> overhead.
> On Sat, Dec 5, 2015 at 4:34 PM Tomáš Linhart <swift-evolution at swift.org>
> wrote:
>> Hello,
>>
>> very often, it is necessary to define stored properties in extensions. It
>> is currently only possible in Swift that has access to ObjC runtime with
>> associated objects (in theory it might be possible with some global
>> dictionary) and it requires a lot of boilerplate. Associated objects are
>> used in UIKit quite heavily so it is something that authors of frameworks
>> need.
>>
>> It would be nice to able to create properties in extensions natively in
>> Swift without need of Objective-C and without a boilerplate. These
>> properties could be marked with some extra keyword/attribute so it is
>> obvious they are different and they have a cost (depends on their
>> implementation).
>>
>> What do you think?
>> Tomáš
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151205/aeb8fdab/attachment.html>
More information about the swift-evolution
mailing list