While that’s true, it’s pretty clearly a hack. Having this built into the
language would not only be a lot more elegant, but could also prevent
override-only methods from showing up in Xcode’s autocomplete.
Charles
> On Oct 7, 2016, at 6:36 PM, Callionica (Swift) via swift-evolution
>
Jon--earlier in the week, there was another thread which once against
raised the idea of internal or private protocol conformances; would that be
another way of addressing your use case here?
On Fri, Oct 7, 2016 at 6:36 PM, Callionica (Swift) via swift-evolution <
swift-evolution@swift.org>
For overridable, but not callable, you can use the technique outlined at
http://www.callionica.com/developer/#swift-protected
(give your method a parameter of a type that only the base class can create)
On Friday, October 7, 2016, Jonathan Hull via swift-evolution <
swift-evolution@swift.org>
I agree with and also feel access modifiers / controls are missing and the
ones we have may not be the best if you factor in these additional needs. I
also agree that I would prefer the discussion be more focused on this type
of thing. Thanks for capturing some of the things you have seen (I have
The discussion of private/fileprivate reminded me of other access modifier
issues that have been bugging me. I agree that the old system is better, but I
am ambivalent about changing it back…
What I pretty much constantly want is an access modifier which lets me access
something from an
Let me bump this thread. How do we move forward?
Here's an interface of another Swift class I've just made (slowly rewriting my
Obj-C components to Swift here):
public class SoloContainerViewController: UIViewController {
private var _contentViewController: UIViewController?
public
>> My point is that "protected" *isn't* access control. If we added it, it
>> would have to be as an independent modifier. Private/internal/public
>> fundamentally affect semantics—private and internal code is only accessible
>> within a module, so we have full knowledge of their use sites at
> Am 31.03.2016 um 17:51 schrieb Joe Groff :
>
>>
>> On Mar 30, 2016, at 11:31 PM, Thorsten Seitz wrote:
>>
>>
>>
>> Am 31. März 2016 um 05:15 schrieb Andrey Tarantsov via swift-evolution
>> :
>>
The problem with
> On Mar 30, 2016, at 11:31 PM, Thorsten Seitz wrote:
>
>
>
> Am 31. März 2016 um 05:15 schrieb Andrey Tarantsov via swift-evolution
> :
>
>>> The problem with protected is that it provides virtually no protection at
>>> all; you can
___
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
> The problem with protected is that it provides virtually no protection at
> all; you can trivially expose it in a derived class
+
> Extensions further dilute the enforceability of "protected", since anyone
> would be able to use an extension to dump methods into a class's namespace
> and
> On Mar 29, 2016, at 18:28, Joe Groff wrote:
>
>
>> On Mar 29, 2016, at 6:18 PM, Joe Groff via swift-evolution
>> wrote:
>>
>>>
>>> On Mar 29, 2016, at 6:04 PM, Dietmar Planitzer via swift-evolution
>>> wrote:
>>>
> On Mar 29, 2016, at 18:18, Joe Groff wrote:
>
>
>> On Mar 29, 2016, at 6:04 PM, Dietmar Planitzer via swift-evolution
>> wrote:
>>
>> Well that would be true if we assume that protected would work that way.
>> Considering that this:
>>
>>
That's the key point.
"Protected" would increase the expressivity of the language by declaring
intent and exposing cleaner public APIs.
I don't think this idea should be dropped just because conscious
hacks/decisions
can workaround it, so big +1 for it.
2016-03-30 5:51 GMT+01:00 Thorsten Seitz
I have no problems with "protected" members being made accessible in subclasses
or extensions because this requires conscious decisions and actions to extend
the API.
Access levels are not there to protect against hacking, they are there to
ensure that something can only be used through its
> On Mar 29, 2016, at 6:18 PM, Joe Groff via swift-evolution
> wrote:
>
>>
>> On Mar 29, 2016, at 6:04 PM, Dietmar Planitzer via swift-evolution
>> wrote:
>>
>> Well that would be true if we assume that protected would work that way.
> On Mar 29, 2016, at 6:04 PM, Dietmar Planitzer via swift-evolution
> wrote:
>
> Well that would be true if we assume that protected would work that way.
> Considering that this:
>
> private class A { … }
>
> public class B : A { … }
>
> is not allowed in Swift,
Well that would be true if we assume that protected would work that way.
Considering that this:
private class A { … }
public class B : A { … }
is not allowed in Swift, I don’t see a good reason why an override of a
protected method should be allowed to upgrade the access level to public. On
I tend to think an intended use annotation that could also be used in Obj-C
would be better than protected. The problem with protected is that it
provides virtually no protection at all; you can trivially expose it in a
derived class, e.g.:
class Protected {
protected func onlyDerived() { ... }
A more sophisticated rights system isn't necessary, but actually, we could
build everything with nothing but "public", so it is always a compromise
between simplicity and expressiveness…
Imho it would be nice to be able to mark a method that is only there to be
overridden and should never be
20 matches
Mail list logo