[swift-evolution] "Assume" directive for classes and methods

Tino Heth 2th at gmx.de
Wed Dec 23 10:16:48 CST 2015


> I've been reading the discussion in "Final by default for classes and methods" and although I don't have a strong position towards what the default behaviour should be, I think a directive to change that behaviour should be added as when nullability was introduced into Obj-C.
> 
> In the current model of Swift, where methods and classes are not final we can ease that by doing something like this:
> 
> ASSUME_FINAL_BEGIN
> class MyClass {
>     func aMethod(arg: String) {
>         
>     }
>     
>     func anotherMethod(number: Int) {
>         
>     }
> }
> ASSUME_FINAL_END

I talked about this possibility in the thread you mention, and there are imho several other issues that could be addressed in a similar way:
[swift-evolution] [Pitch] make @noescape the default
[swift-evolution] Make non-void functions @warn_unused_result by default

But there would be one big downside:
All this fruitless arguing about better defaults keeps amateurs like me busy — just imagine the havoc I'd cause in the complicated and important topics ;-)

Best regards,
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151223/75695df4/attachment.html>


More information about the swift-evolution mailing list