[swift-evolution] [Proposal] Foundation Swift Archival & Serialization

Zach Waldowski zach at waldowski.me
Thu Mar 16 13:34:56 CDT 2017

On Thu, Mar 16, 2017, at 02:23 PM, Matthew Johnson via swift-evolution wrote:
> I don’t have an example but I don’t see a problem either.  There are
> two options for specifying the return type manually.  We can use the
> signature you used above and use `as` to specify the expected type:

> let i = decode(.myKey) as Int

The awkwardness of this syntax is exactly what I'm referring to. Would a
beginner know to use "as Int" or ": Int"? Why would they? The
"prettiness" of the simple case doesn't make up for how difficult it is
to understand and fix its failure cases.

Any official Swift or Foundation API shouldn't, or shouldn't need to,
make use of "tricky" syntax.

> If we don’t support this in Foundation we will continue to see 3rd
> party libraries that do this.

The proposal's been out for less than 24 hours, is it really productive
to already be taking our ball and go home over such a minor thing?

Zach Waldowski

zach at waldowski.me

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170316/92e4af43/attachment.html>

More information about the swift-evolution mailing list