[swift-evolution] [Review] SE-0159: Fix Private Access Levels

Xiaodi Wu xiaodi.wu at gmail.com
Sat Mar 25 01:27:31 CDT 2017


On Sat, Mar 25, 2017 at 1:11 AM, Carl Brown1 <Carl.Brown1 at ibm.com> wrote:

> Yes, it would change my opinion of it. I wouldn't become a strong
> supporter because I don't see any value in it, but a rigorous proof that
> this proposal could not possibly introduce regressions to any existing
> codebases would change my opinion from "strongly against" to "doesn't
> matter to me, I'll stop arguing against it and go get my real work done".
>

Well, that's promising, I guess? I think it's entirely reasonable to want a
migration path that can demonstrably preserve the behavior of existing
codebases.

For most use sites, it would be no more than find-and-replace; a more
sophisticated process will be required for scenarios where a private
declaration uses a name identical to something called elsewhere in the
file--in the worst case, a renaming will be required, such as in a case
like this:

```

func f() -> String {

  return "A"

}


struct S {

  static func g() -> String {

    return f()

  }

}


extension S {

  private static func f() -> String {

    return "B"

  }

}


S.g()
```

This will require some compiler smarts. And I think a successful proposal
would have to provide solid proof that all such scenarios are covered. I'll
think about this over the weekend.

>
>
> -Carl
>
> [image: Inactive hide details for Xiaodi Wu ---03/25/2017 12:33:55
> AM---Would it change your opinion on the proposal? On Sat, Mar 25, 2]Xiaodi
> Wu ---03/25/2017 12:33:55 AM---Would it change your opinion on the
> proposal? On Sat, Mar 25, 2017 at 12:10 AM, Carl Brown1 <Carl.Br
>
> From: Xiaodi Wu <xiaodi.wu at gmail.com>
> To: Carl Brown1/US/IBM at IBM
> Cc: Drew Crawford <drew at sealedabstract.com>, Jonathan Hull <jhull at gbis.com>,
> swift-evolution <swift-evolution at swift.org>
> Date: 03/25/2017 12:33 AM
> Subject: Re: [swift-evolution] [Review] SE-0159: Fix Private Access Levels
> ------------------------------
>
>
>
> Would it change your opinion on the proposal?
>
>
> On Sat, Mar 25, 2017 at 12:10 AM, Carl Brown1 <*Carl.Brown1 at ibm.com*
> <Carl.Brown1 at ibm.com>> wrote:
>
>    I would very much like to see your proof that the resultant code is
>    unchanged in an arbitrary codebase.
>
>    -Carl
>
>    [image: Inactive hide details for Xiaodi Wu ---03/25/2017 12:01:26
>    AM---On Fri, Mar 24, 2017 at 11:55 PM, Carl Brown1 <Carl.Brown1 at ibm.]Xiaodi
>    Wu ---03/25/2017 12:01:26 AM---On Fri, Mar 24, 2017 at 11:55 PM, Carl
>    Brown1 <*Carl.Brown1 at ibm.com* <Carl.Brown1 at ibm.com>> wrote: > Maybe
>    this is the core
>
>    From: Xiaodi Wu <*xiaodi.wu at gmail.com* <xiaodi.wu at gmail.com>>
>    To: Carl Brown1/US/IBM at IBM
>    Cc: Drew Crawford <*drew at sealedabstract.com* <drew at sealedabstract.com>>,
>    Jonathan Hull <*jhull at gbis.com* <jhull at gbis.com>>, swift-evolution <
>    *swift-evolution at swift.org* <swift-evolution at swift.org>>
>    Date: 03/25/2017 12:01 AM
>    Subject: Re: [swift-evolution] [Review] SE-0159: Fix Private Access
>    Levels
>    ------------------------------
>
>
>
>    On Fri, Mar 24, 2017 at 11:55 PM, Carl Brown1 <*Carl.Brown1 at ibm.com*
>    <Carl.Brown1 at ibm.com>> wrote:
>
>    My point is that, in rolling back the specific portion of SE-0025,
>    case-sensitive find-and-replace will be the trickiest thing in most
>    codebases, save those that result in invalid redeclarations. The behavior
>    of the resultant code is, unless I'm mistaken, provably unchanged.
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170325/9fb771ab/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170325/9fb771ab/attachment.gif>


More information about the swift-evolution mailing list