[swift-evolution] [Pitch] Introduce user-defined dynamically "callable" types
Goffredo Marocchi
panajev at gmail.com
Sat Nov 11 11:44:09 CST 2017
Very interesting indeed...
class VehicleUtilities {
int numberOfAxles(Vehicle v) { return 2;} // a plausible default
int numberOfAxles (Truck t){ return 3;}
}
Vehicle v = new Truck();
VehicleUtilities u = new VehicleUtilities();
u.numberOfAxles(v); // returns 2
--> this is a nice concise example of even simple code can suffer from a
nasty code issue such as this...
On Sat, Nov 11, 2017 at 4:32 PM, Gwendal Roué via swift-evolution <
swift-evolution at swift.org> wrote:
>
> Le 11 nov. 2017 à 16:48, Joe Groff via swift-evolution <
> swift-evolution at swift.org> a écrit :
>
> That'd be great, but Swift violates Gilad Bracha's golden rule by having
> static overloading, and throws bidirectional type inference on top, so our
> static name resolution can't be treated as a specialization of a dynamic
> name lookup mechanism in all cases.
>
>
> I didn't know of Gilad Bracha, so you made me curious.
>
> I guess that the "golden rule" you refer to is here, for anyone curious:
> https://gbracha.blogspot.fr/2009/09/systemic-overload.html
>
> Gwendal Roué
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171111/563fb5aa/attachment.html>
More information about the swift-evolution
mailing list