[swift-evolution] [swift-build-dev] [Review] SE-0158 Package Manager Manifest API Redesign

Xiaodi Wu xiaodi.wu at gmail.com
Sat Mar 11 18:41:37 CST 2017


On Thu, Mar 9, 2017 at 12:34 AM, Ankit Aggarwal via swift-evolution <
swift-evolution at swift.org> wrote:

>
>
>> +1, although I don’t know why we're supporting this:
>>
>> // 1.5.8 ..< 2.0.0.package(url: "/SwiftyJSON", from: "1.5.8"),
>>
>> when, at least as far as I can tell, this:
>>
>> // 1.5.8 ..< 2.0.0.package(url: "/SwiftyJSON", .uptoNextMajor("1.5.8")),
>>
>> does the same thing, and the spelling is, at least to me, clearer as
>> well. Dunno, maybe the “from” version is a term of art that I’m just not
>> familiar with.
>>
>>
> Hi David,
>
> Thank you for the review.
>
> It is true that `from` and `.uptoNextMajor` are exactly same. We think
> that the most widely used requirement will be `.uptoNextMajor`, so we
> wanted to provide a shorthand for it.
>

Kind of a late reply, but overall I think the proposal looks good with the
exception of some of these `Requirement` vs. shorthand dichotomies. It
looks like the following will be synonyms:

```
.package(url: "/SwiftyJSON", branch: "develop")
.package(url: "/SwiftyJSON", .branch("develop"))
```

...as well as...

```
.package(url: "/SwiftyJSON", revision:
"e74b07278b926c9ec6f9643455ea00d1ce04a021")
.package(url: "/SwiftyJSON",
.revision("e74b07278b926c9ec6f9643455ea00d1ce04a021"))
```

It seems odd that there are two subtly different but equivalent ways to
spell the same thing like that. But I get that there are possibilities for
chaining made available with the latter notation and that the former was
promised in a fairly new proposal that's been approved. Where it gets more
unsatisfactory, IMO, is that

```
.package(url: "/SwiftyJSON", .only("1.5.8"))
.package(url: "/SwiftyJSON", .exact("1.5.8"))
```

also seem to mean the same thing. Here, this is actively confusing, because
every user will inevitably scratch their head trying to parse out the
difference. I also share Dave's concern about

```
.package(url: "/SwiftyJSON", from: "1.5.8")
.package(url: "/SwiftyJSON", .uptoNextMajor("1.5.8"))
```

There is no intuition that would tell a user that the two are the same;
after all, `uptoNextMinor` also starts "from" its argument. I understand
that the latter is wordier, but it is not such a grave burden that the
argument label couldn't be rewritten also as `uptoNextMajor`.

While we're on the topic, the standard library spelling is `upTo` rather
than `upto`, and while it's nitpicky I think it's important to go with the
former given that "upto" is not a single word in standard English. If we
wanted this to read more grammatically, consider also `.upToNextMajor(from:
"1.5.8")`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170311/1a554b7d/attachment.html>


More information about the swift-evolution mailing list