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

Chris Lattner clattner at nondot.org
Mon Dec 4 14:35:17 CST 2017


> On Dec 4, 2017, at 12:12 PM, Vladimir.S via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Probably the correct way to have dynamic calls in Swift is to 'mark' such code with special flag and we need to find it. For example:
> 
> > // Python:        d = np.array([1, 2, 3], dtype="i2")
> > // Future Swift:  let d = np. at array([6, 7, 8], dtype: "i2")
> > // Future Swift:  let d = np at array([6, 7, 8], dtype: "i2")
> > // Future Swift:  let d = np:array([6, 7, 8], dtype: "i2")
> > // Future Swift:  let d = np.~array([6, 7, 8], dtype: "i2")
> > // Future Swift:  let d = np. at array([6, 7, 8], dtype: "i2")
> > // Future Swift:  let d = np."array"([6, 7, 8], dtype: "i2") // name of dynamic method is like just string, no any guarantee & we can have any needed symbol in string to express the details of target dynamic language(if needed)
> > // etc
> 
> Yes, IMO such code should be second class citizen in Swift.

This idea was discussed extensively upthread, and has been specifically addressed in the proposal:
https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#increasing-visibility-of-dynamic-member-lookups <https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#increasing-visibility-of-dynamic-member-lookups>

-Chris

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


More information about the swift-evolution mailing list