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

Joe DeCapo snoogansbc at gmail.com
Wed Dec 6 20:52:45 CST 2017


> On Dec 6, 2017, at 5:46 PM, Letanyan Arumugam <letanyan.a at gmail.com> wrote:
> 
> But IUO’s are marked with an “!” to differentiate it from a normal type, where as DynamicMemberLookup is just a normal protocol conformance. I would be curious as to what you think of this idea [1]? Would this still be too much of a constraint just to make sure that when people use this they’re explicitly aware of what they’re doing?

I think that sort of approach seems like an acceptable middle ground. There's probably some bike-shedding to be done about the terminology and such. I just think it's overboard to require explicit annotations at the call site (especially for every single call site invocation). I would totally be fine with some sort of extra annotation at the declaration site beyond a normal protocol conformance. I do think this jibes well with C#'s `dynamic` approach from what I've gathered so far, and which other people seem to think is a worthy standard we should look toward for inspiration.

My main objection to many of the critical responses to the proposal is that the examples all seem to ignore where the variables that are being invoked come from. I think we all tend to have a pretty good idea of what types we're dealing with, and what their behaviors are. And when we run into issues, we inspect those types. If this makes it more apparent on inspection that it has some special behavior, then I'm all for that. It would be similar to inspecting a type that crashed which turned out to be an IUO.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171206/4933946c/attachment.html>


More information about the swift-evolution mailing list