[swift-evolution] Proposal: Introduce User-defined "Dynamic Member Lookup" Types

Chris Lattner clattner at nondot.org
Wed Dec 6 11:14:49 CST 2017


On Dec 6, 2017, at 5:41 AM, Vincent Esche via swift-evolution <swift-evolution at swift.org> wrote:
> Alas while Swift's generics provide a nice basic foundation, they still have big gaps in what can be expressed through them.
> And i'm not talking about HKT or any such more advanced use of types). I'm talking about the basic stuff. Generic abstractions over type conversion. Generic abstractions over arithmetic operators. This kind of stuff. Stuff, that ironically would be necessary for a generic yet idiomatic implementation of Linear Algebra algorithms in Swift.

This is all orthogonal to the proposal.  I’m certainly not opposed to the generics system getting better :-), but there isn’t some opportunity cost where you choose one or the other.  The Swift team at Apple which are doing the majority of the generics work isn’t going to implement these proposals.

> And I think that we have more urgent topics at hand that need to get fixed.
> Swift's generics are very limited. We hardly have any tooling.
> Diagnostics are just shy of migrating from "utter garbage" to "getting usable", by modern standards.
> Integration with Xcode still to this day is an utter clusterfuck. With errors pointing to the void, regularly.
> I'd prefer the team to focus on these, solidifying the foundation and once that's done
> and the result have been proven to be sound by time I'd love to see Swift get some more dynamism.

I’m not disagreeing with your point about other things needing to be improved, but the only question is whether this proposal fits with the right long term direction for Swift.  It is not a prioritization question.

> At this point in time it's like opening Pandora's box.

I, still, have yet to see any evidence of harm that this proposal can cause.

> - How do you plan to teach the proper use of this feature? How would the documentation introduce it
> and how would it ensure that people fully understand its purpose and what it decidedly is _not_ for?
> - How would the diagnostics (in particular in code mixing static and dynamic Swift) look like?
> - How would the debugging of dynamic APIs look like?

This is an expert-only feature like the ExpressibleBy protocols.  This is not something that will be introduced or taught in chapter one of the Swift book, or in the Swift Tour.

-Chris




More information about the swift-evolution mailing list