[swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}

David Sweeris davesweeris at mac.com
Sun Oct 22 14:20:26 CDT 2017

> On Oct 20, 2017, at 22:18, Eagle Offshore <eagleoffshore at mac.com> wrote:
>> On Oct 20, 2017, at 2:55 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
>> how else are we supposed to express nuances when the language’s default is wrong for the code in question?
> Fix the defaults?

K, then how do you express nuances where the “fixed” defaults are wrong?

> Honestly, I'm not sure how I've been programming for so long (30+ years) without having to add half a dozen annotations to every single declaration.

Different languages offer different levels of “compiler smarts”, and have different mechanisms for exposing said “smarts”. What language(s) are you used to?

> "If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one? 
> — Tom Cargill"
> Same applies to Swift at this point.  Its jumped the shark on annotations.

I think @discardableResult is the only one that’s generally used much in non-library code... There’s an annotation to specify the inlining behavior for when you don’t want the compiler making that decision, and one for something about transparency in the stdlib (I don’t think it’s part of the “public” language, though, because it starts with a “_”). I wouldn’t be too surprised if I’ve missed something, but AFAIK, Swift currently only has those two or three.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171022/0678ecc4/attachment.html>

More information about the swift-evolution mailing list