[swift-evolution] Static Dispatch Pitfalls

Fabian Ehrentraud Fabian.Ehrentraud at willhaben.at
Sun May 22 07:28:15 CDT 2016


> Am 22.05.2016 um 08:49 schrieb Vladimir.S via swift-evolution <swift-evolution at swift.org>:
> 
>> On 22.05.2016 3:01, L. Mihalkovic via swift-evolution wrote:
>> Read the proposal... I have an aversion to-go coffee cups that remind
>> people that hot coffee may burn them, and when my daughter was 4 we
>> explained to her why knives were to be handled with care, rather than
>> remove them all from her sight. IMHO the proposal evoques mandating
>> training wheels rather than letting people learn naturally from their
>> errors.
> 
> I can partially support this opinion. But we have a situation with protocol extension methods and static dispatches in which we need Swift's help on compilation stage. IMO Using your words, right now we just got knife in our hands *without* any explanation. Then we hurt ourselves, and *then* we know that such methods will be dispatched statically(and the rule of dispatch is quite non-obvious). This is another extreme like "remove all knives". We need some golden middle. Personally I believe the solution is in compiler warning and in some method to 'fix' this warning.

In other words, we should declare knives as UnsafePointy things ;-)


More information about the swift-evolution mailing list