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

Nick Keets nick.keets at gmail.com
Mon Dec 4 06:45:47 CST 2017


On Sun, Dec 3, 2017 at 10:16 PM, Matthew Johnson via swift-evolution <
swift-evolution at swift.org> wrote:

>
> Some people are big fans of dynamic behavior and this feature will make it
> much easier to write code in that style.  They will do it without feeling
> malicious or considering this to be abusive, considering it to be a
> legitimate style preference.  I wouldn’t be surprised to see people develop
> mixins that implement the subscript using mirror and other future
> reflection capabilities without considering that to be abusive (I would
> almost be surprised if this *didn’t* happen).  Requiring some kind of
> usage site annotation would both discourage this and help anyone who walks
> into a such a code base to understand what is going on.
>


I really don't understand this fear of metamorphosis. People could also be
using emoji for all their variables. So what? Let them do it!

Are you afraid that this kind of code will eventually become idomatic Swift
and soon all the good 3rd party libraries will be written like this? If
yes, that means that Swift has failed as a language, people really wanted
another Javascript. If not, what's the harm? Maybe eventually people doing
this will realize that "proper" Swift is better. Or not.

Right now there are a lot of people writting Swift in an Objective-C style.
e.g. using classes when they should have used structs, using inheritance
when they should have used protocols. Should we add some language feature
to stop them?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171204/decfcc1c/attachment.html>


More information about the swift-evolution mailing list