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

Chris Lattner clattner at nondot.org
Mon Nov 27 13:02:58 CST 2017


On Nov 27, 2017, at 8:57 AM, Mathew Huusko V <mhuusko5 at gmail.com> wrote:
> You're saying that there is universally no inherent difference, and that all calls "determine if you have called it" correctly, but then picked one of only a handful of cases in current practice where that is actually true. Yes "+" (/other math operators) and array access are unsafe, but most other things in Swift are safe by default, and you have to opt into un-safety (e.g. forcing or checking an optional or throwing call) — this is a main tenant of the language.

There is nothing unsafe about this proposal.  It is fully type safe and supports failable operations (by having the properties typed as optionals).  This is shows by example in the proposal.

Your explanation above is so confusing to me.  The closest analog to this feature is AnyObject dynamic lookup, which *is* completely unsafe, and is pervasively tangled throughout the compiler.   Maybe you’re confusing the two.

-Chris



More information about the swift-evolution mailing list