[Pitch] Memberwise initialisers adopt the same access modifiers as the struct

Not much to this one… I think the memberwise `init` should follow the same level of access as the struct. It appears to default to `internal` regardless of the struct access modifiers

Thoughts?

Not much to this one… I think the memberwise `init` should follow the same level of access as the struct. It appears to default to `internal` regardless of the struct access modifiers

Thoughts?

There was an extensive discussion and review of a proposal I put forward early this year for improving memberwise initialization. This topic has been deferred until after Swift 3 wraps up. We’ll be revisiting it in the coming months.

···

On Jul 20, 2016, at 8:15 PM, Ian Keen via swift-evolution <swift-evolution@swift.org> wrote:

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I did see that one, however it appeared that proposal didn’t could on the access of the initialiser itself at all? just how it interacts with different properties access levels. It was kinda gargantuan, I’m proposing a single behavioural change for now, rather than introducing a ton of new features.

I would almost consider this a bug.

···

> On Jul 20, 2016, at 8:15 PM, Ian Keen via swift-evolution<swift-evolution@swift.org>wrote:
>
> Not much to this one… I think the memberwise `init` should follow the same level of access as the struct. It appears to default to `internal` regardless of the struct access modifiers
>
> Thoughts?
There was an extensive discussion and review of a proposal I put forward early this year for improving memberwise initialization. This topic has been deferred until after Swift 3 wraps up. We’ll be revisiting it in the coming months.

>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

I did see that one, however it appeared that proposal didn’t could on the access of the initialiser itself at all? just how it interacts with different properties access levels. It was kinda gargantuan, I’m proposing a single behavioural change for now, rather than introducing a ton of new features.

I would almost consider this a bug.

This is an additive change so it is out of scope for Swift 3 no matter how small. There are already plans to revisit the memberwise initialization discussion after Swift 3 is out. I encourage you to join that discussion when it gets going.

···

Sent from my iPad

On Jul 21, 2016, at 11:26 AM, Ian Keen <iankeen82@gmail.com> wrote:

On Jul 20, 2016, at 8:15 PM, Ian Keen via swift-evolution<swift-evolution@swift.org>wrote:

Not much to this one… I think the memberwise `init` should follow the same level of access as the struct. It appears to default to `internal` regardless of the struct access modifiers

Thoughts?

There was an extensive discussion and review of a proposal I put forward early this year for improving memberwise initialization. This topic has been deferred until after Swift 3 wraps up. We’ll be revisiting it in the coming months.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Have this proposal be revisited? It would be really cool to have the synthesised initialiser have the same access level as the struct itself, specially that now it contains all the properties of the struct.

2 Likes

The latest memberwise initialization thread is from last spring: Explicit Memberwise Initializers. I think the design I pitched in that thread is a step in the right direction. But this topic won't really get traction until somebody interested in working on an implementation comes along.

2 Likes