[swift-evolution] [Review] SE-0023 API Design Guidelines

Douglas Gregor dgregor at apple.com
Sun Jan 24 00:05:50 CST 2016

> On Jan 22, 2016, at 2:04 PM, Thomas Visser <thomas.visser at gmail.com> wrote:
>> Uses of non-mutating methods should read as noun phrases when possible, e.g. x.distanceTo(y), i.successor().
> This seems to indicate (to me) that e.g. Optional.map and should be renamed to Optional.mapped? Except that ‘map’ in this case could be considered a ’term of art’. Would it make sense to add to add some kind of guidance on how to weigh the individual guidelines when they are conflicting?

When we discussed this, we felt like “map” was a term of art. It’s also the case that, generally speaking, “map” cannot be mutating unless you’re mapping from T -> T.

As for general guidance on how to weigh the guidelines… I’m not sure we could write anything here that would actually help. There is always judgment involved in API design, and “when should one prefer a term of art?” is very much a judgment call.

	- Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160123/017be233/attachment.html>

More information about the swift-evolution mailing list