[swift-evolution] [Pitch #2] Introduce User-defined "Dynamic Member Lookup" Types
Chris Lattner
clattner at nondot.org
Sun Dec 3 11:02:50 CST 2017
> On Dec 2, 2017, at 7:58 PM, Jose Cheyo Jimenez <cheyo at masters3d.com> wrote:
>
> Hi Chis,
>
> Thank you for pushing this forward.
>
> My only comment is that on the declaration side it would be great to also have an attribute to communicate that compiler magic is happening.
>
> Currently it is surprising that a regular looking protocol is providing me so much power.
>
> Suggestions:
>
> @dynamic
> struct PyVal : MemberLookupProtocol {...}
>
> @dynamic
> struct ParameterSummer : DynamicCallable {...}
>
> // Error: This type needs the @dynamic attribute.
> class ParamWinter : MyCustomCallableProtocolOrClassOrTypeAlias {...}
>
> By requiring @dynamic (Or other attribute name), people can know that this is a compiler dynamic declaration and not just some random protocol whose name starts with Dynamic*. :)
I’m not a huge fan of this (because it is redundant as Jean-Daniel mentions downthread), but it is definitely possible. I’ll add it to the alternatives section so that people consider it during review.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171203/19c805b5/attachment.html>
More information about the swift-evolution
mailing list