[swift-evolution] adding automated-testing of uncompilable features in XCTest

Derrick Ho wh1pch81n at gmail.com
Thu Dec 15 00:23:46 CST 2016


Use protocols

{get}
Can be used for let

{get set}
Can be used for var
On Thu, Dec 15, 2016 at 1:16 AM Benjamin Spratling via swift-evolution <
swift-evolution at swift.org> wrote:

> Howdy,
>         Thanks, I’ll consider this as an alternative.
>         I don’t see that this solves the issues of whether a property on a
> class is let, however.
> -Ben
>
> > On Dec 14, 2016, at 11:41 PM, Derrick Ho <wh1pch81n at gmail.com> wrote:
> >
> > You might be able to ensure access modifiers by using protocols.
> >
> > If you want to ensure that a class has a property called foo that is
> private you can make a private protocol that specifies a private property
> called foo.
> >
> > This isn't a XCTest but it is a compile time check. If a programmer
> tries to change a private property to public then the the compiler will
> complain.
> >
> > The same can be done with final. Make a protocol with a static method.
> _______________________________________________
> 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/20161215/fbd8d076/attachment.html>


More information about the swift-evolution mailing list