[swift-evolution] [Review] SE-0090: Remove .self and freely allow type references in expressions

Xiaodi Wu xiaodi.wu at gmail.com
Wed May 18 01:05:29 CDT 2016

On Tue, May 17, 2016 at 8:33 PM, Chris Lattner via swift-evolution <
swift-evolution at swift.org> wrote:

>         * What is your evaluation of the proposal?

I suspect few would argue against the premise, namely that .self should go.
One quibble with the details, though:

  useType([Int])         // Passes Array<Int>
  useArray([Int])         // Passes an array, containing Int

This seems a little magical; by contrast, [Int.self] vs. [Int].self is
unambiguous. Moreover (not that I can conceive of a use for it), wouldn't
things get hairy if one tries to express `[[Int].self]`? I'd like to
propose an alternative:

Python has a trailing comma rule for tuples. That is, to distinguish a
parenthesized expression from a single-item tuple, the latter must be
written as `(item,)`. Perhaps the same idea could be used in this case.
That is:

[Int] // Array<Int>
[Int,] // an array, containing one element Int

        * Is the problem being addressed significant enough to warrant a
> change to Swift?
>         * Does this proposal fit well with the feel and direction of Swift?
>         * If you have used other languages or libraries with a similar
> feature, how do you feel that this proposal compares to those?
>         * How much effort did you put into your review? A glance, a quick
> reading, or an in-depth study?
> More information about the Swift evolution process is available at
>         https://github.com/apple/swift-evolution/blob/master/process.md
> Thank you,
> -Chris Lattner
> Review Manager
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160517/1b507653/attachment.html>

More information about the swift-evolution mailing list