[swift-dev] Delaying the enforcement of ".self" out of Swift 3?
Erica Sadun
erica at ericasadun.com
Thu Jun 2 15:24:04 CDT 2016
> On Jun 2, 2016, at 2:21 PM, Douglas Gregor via swift-dev <swift-dev at swift.org> wrote:
>
> Hi all,
>
> While working on some unrelated refactoring, I stumbled across a minor fix that would make use properly enforce “.self” when we want to get the metatype of a named type. For example, the Swift compiler currently (incorrectly) allows
>
> sizeof(UInt)
>
> which should be
>
> sizeof(UInt.self)
>
> The fix for this is actually pretty simple (patch attached), but the question is… do we want to fix the problem, if we think that we’ll get SE-0090 that makes “.self” go away?
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0090-remove-dot-self.md
>
> On the one hand, I want to fix the problem:
>
> * This came out of a desire to make the AST more sane. Essentially, the folding of expressions into TypeExprs—which will go away entirely if/when SE-0090 is implemented—is pulling in the parentheses describing call arguments. Without the fix, we still have weird AST.
> * SE-0090 is labeled as “deferred out of Swift 3”, so having the compiler not implement the stated language for an entire release cycle seems really unfortunate.
>
> OTOH, I don’t want to jerk people’s code around, forcing them to add “.self” now only to remove it a year from now (or whenever).
>
> Thoughts?
1. You just caused me a bunch of extra work. (*shakes fist*)
2. Consistency and correctness are more important than concision.
3. If it can be fixed, fix it. (It is a bug.) And THEN change the language using the normal SE evolution process.
4. I'd like you to settle this as quickly as possible.
-- E, not happy that she's answering this way because see point 1
More information about the swift-dev
mailing list