[swift-evolution] [Pitch] "unavailable" members shouldn't need an impl

Austin Zheng austinzheng at gmail.com
Fri Jun 10 16:31:07 CDT 2016


Sorry, but I'm going to have to disagree with you on this one.

On Fri, Jun 10, 2016 at 2:26 PM, Erica Sadun <erica at ericasadun.com> wrote:

> On Jun 10, 2016, at 3:22 PM, Austin Zheng via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> So, instead of:
>
> @available(*, unavailable, renamed:"someNewAPI()")
> public func someOldAPI() -> Int { fatalError() }
>
> You can just have:
>
> @available(*, unavailable, renamed:"someNewAPI()")
> public func someOldAPI() -> Int
>
> The intent is, in my opinion, clearer for the latter and it feels less
> kludgy.
>
>
> You ask, we answer. I'd much prefer spelling out {
> fatalError("unavailable API") }.
> It makes the code clearer to read, to maintain,
>

The member is marked as "unavailable" in the @available annotation. I don't
see how adding a fatalError() in the body makes it any clearer or easier to
read.


> it produces debug and runtime errors. etc.
>

I'm not sure how you can even compile code that uses an API marked as
"unavailable", given that using such an API causes the compiler to error.


> I think
> this is an example where concision is overrated.
>
> -- E
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160610/c543755e/attachment.html>


More information about the swift-evolution mailing list