Sent from my iPhone

> On 9 Jul 2016, at 05:39, Jordan Rose via swift-evolution 
> <[email protected]> wrote:
> 
> Of course, Swift doesn’t allow this. If someone outside of the module 
> subclasses ModelBase, there’s no way for them to provide the 
> dynamically-dispatched 'init(context:)’, because they don’t have access to 
> the internal ModelContext.

Shouldn't Swift allow this? Wouldn't it be better if we found a different way 
to handle this than a brute force "you shall only subclass if I think you 
should"? Is that really an impossible cause that is worth us going completely 
the opposite direction of most programming languages?

Can you tell me why the onus should not be on you, on library authors, to use 
final or an equivalent keyword to indicate no subclassing is allowed and thus 
make this intentional?

I am really not sold on why classes should not be subclassable by default. Not 
all classes suffer of the problem you mention and for those cases you should be 
able to express your intention explicitly. I am quite against this being a 
compiler default.

I think that security by ignorance, which is what automagically enforced rules 
tend to produce over time, does have some side effects.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to