> On Nov 16, 2017, at 4:49 AM, Michel Fortin via swift-evolution > <[email protected]> wrote: > > 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.
I’m totally open to suggestions for a better name, but I don’t see what “Supplemental” is adding here. Recall that this protocol is compiler “magic” that is part of an implementation of a type, it isn’t really part of the user-exposed API of the type. I wouldn’t expect a user to ever write: pyVal[dynamicMember: “foo”] Even though they could. Maybe we need to add private conformances to Swift or something :-) -Chris > > >> Le 15 nov. 2017 à 2:29, Chris Lattner via swift-evolution >> <[email protected] <mailto:[email protected]>> a écrit : >> >> protocol DynamicMemberLookupProtocol { >> associatedtype DynamicMemberLookupValue >> >> subscript(dynamicMember name: String) -> DynamicMemberLookupValue { get >> set } >> } >> > > -- > Michel Fortin > https://michelf.ca <https://michelf.ca/> > _______________________________________________ > swift-evolution mailing list > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
