[swift-evolution] [Review] SE-0059: Update API Naming Guidelines and Rewrite Set APIs Accordingly

Michel Fortin michel.fortin at michelf.ca
Sun Apr 3 08:41:24 CDT 2016


> What is your evaluation of the proposal?

I don't like "form" as a prefix. To me there is no difference between `union` and `formUnion`: both sounds functional-style, and actually the second one perhaps a bit more to my ears. There's basically two dictionary definitions of "form":

1. "bring together parts or combine to create (something)" which to me implies a new value is created, and
2. "make or fashion into a certain shape or form" which would imply that the material you start with is transformed, which is apparently the intended meaning and also the reverse meaning from the above.

I mean, doesn't this make sense as an API?

	let donut = baker.formDonut(dough) // non-mutating

Perhaps instead of "form" we could use "become" as a prefix when the operation is naturally described by a noun. That would seem less ambiguous to me:

	a.becomeUnion(b)
	a.becomeIntersection(b)
	a.becomeSuccessor(b)

It's a bit passive, but I find it fits well when the operation is a noun.

And there's no way the term lends itself to non-mutating cases without things becoming nonsensical:

	let donut = baker.becomeDonut(dough) // non-mutating?


> Is the problem being addressed significant enough to warrant a change to Swift?

I'm still not entirely convinced any of this is better than the `InPlace` suffix we had before. `InPlace` might be ugly visually and grammatically, but seems to be the clearest at expressing the intent.


> Does this proposal fit well with the feel and direction of Swift?

There is no question that using a verb instead of the `InPlace` suffix makes things fits better with the other API guidelines.


> If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

N/A


> How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Read the guideline and API diffs, thought about a few alternative wording, looked in my dictionary.


-- 
Michel Fortin
https://michelf.ca



More information about the swift-evolution mailing list