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

Michel Fortin michel.fortin at michelf.ca
Thu Nov 16 06:49:24 CST 2017


I think this protocol and its subscript need a better name. From a user of the class point of view, the subscript looks like you can retrieve the members of the class, whereas in reality you'll only get the ones you have manually implemented. Even methods and properties having the `dynamic` attribute won't be available, even though the subscript name would suggest that.

I would propose adding the word `supplemental`to the subscript name and the name of the protocol to make it clearer that this is only for adding members that are not declared in the class (including the `dynamic` ones).

As in `SupplementalDynamicMemberLookupProtocol` and `supplementalDynamicMember` for the subscript.


> Le 15 nov. 2017 à 2:29, Chris Lattner via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> protocol DynamicMemberLookupProtocol {
>   associatedtype DynamicMemberLookupValue
> 
>   subscript(dynamicMember name: String) -> DynamicMemberLookupValue { get set }
> }
> 

-- 
Michel Fortin
https://michelf.ca

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171116/2963a7da/attachment.html>


More information about the swift-evolution mailing list