[swift-evolution] Python Interop with Swift 4+
brent at architechies.com
Tue Nov 21 21:17:28 CST 2017
> On Nov 20, 2017, at 10:50 AM, Slava Pestov via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> What if you write ‘let fn = obj.method’?
Since Ruby doesn't distinguish between properties and methods, I would write the `subscript(dynamicProperty:)` getter to be equivalent to a zero-argument method call. This is a pragmatic tradeoff—property access is *way* more common than uncalled method access.
I assume that Swift would send `rubyObject.someMethod(_:_:)` through a method-related call, not a property-related one. Having a way to unambiguously specify a zero-argument method would allow the uncalled syntax to be used with Ruby methods which would otherwise be interpreted as properties.
(The setter on properties would handle the problem of Ruby's `=` methods. As for `?` and `!`, unless we extend the `identifier` syntax to allow non-identifier characters, I'd actually be tempted to bridge them with `is` and `unsafe` prefixes respectively. That might be a little too cute, though.)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution