Re: [swift-evolution] Python Interop with Swift 4+

2017-11-22 Thread Brent Royal-Gordon via swift-evolution
> On Nov 20, 2017, at 10:50 AM, Slava Pestov via swift-evolution > > wrote: > > What if you write ‘let fn = obj.method’? Since Ruby doesn't distinguish between properties and methods, I would write the `subscript(dynamicProperty:)`

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Waite via swift-evolution
> I think you’re missing the idea here: the idea isn’t to provide exactly > syntax mapping of Ruby (or Python) into Swift, it is to expose the underlying > semantic concepts in terms of Swift’s syntax. In the case of Python, there > is a lot of direct overlap, but there is also some places

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Chris Lattner via swift-evolution
> On Nov 20, 2017, at 12:50 PM, David Hart via swift-evolution > wrote: > > > >> On 20 Nov 2017, at 21:10, Chris Lattner via swift-evolution >> > wrote: >> >> >>> On Nov 20, 2017, at 10:50 AM, Slava

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Chris Lattner via swift-evolution
> On Nov 20, 2017, at 1:41 PM, David Waite wrote: > > In ruby, parens are optional. So, > > v = foo.value > > and > > v = foo.value() > > are identical. Ok, I wasn’t aware of that. It isn’t clear that we’d want to carry that into a “Ruby APIs when used in

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Waite via swift-evolution
In ruby, parens are optional. So, v = foo.value and v = foo.value() are identical. There dot syntax is only used for method invocation, so there is no external access to instance variables without some twiddling; similarly getting access to a Proc/lambda/Method requires twiddling in Ruby

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Hart via swift-evolution
> On 20 Nov 2017, at 21:10, Chris Lattner via swift-evolution > wrote: > > >> On Nov 20, 2017, at 10:50 AM, Slava Pestov via swift-evolution >> > wrote: >> >> >> >>> On Nov 20, 2017, at 1:39 PM, Chris

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Chris Lattner via swift-evolution
> On Nov 20, 2017, at 10:50 AM, Slava Pestov via swift-evolution > wrote: > > > >> On Nov 20, 2017, at 1:39 PM, Chris Lattner via swift-evolution >> > wrote: >> >> It is straight-forward (and fits very

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Slava Pestov via swift-evolution
> On Nov 20, 2017, at 1:39 PM, Chris Lattner via swift-evolution > wrote: > > It is straight-forward (and fits very very naturally into the Swift call > model) to support the second one as an atomic thing, which is I think what > you’re getting at. What if you

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Chris Lattner via swift-evolution
> On Nov 20, 2017, at 12:16 AM, David Hart via swift-evolution > wrote: > I’ve had a quick look into how your proposals will allow interop with other > dynamic languages. It seems that the model that you chose, where calling a > function is a two-step process

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Paul Cantrell via swift-evolution
> On Nov 20, 2017, at 7:08 AM, David Hart via swift-evolution > wrote: > > > >> On 20 Nov 2017, at 12:34, Brent Royal-Gordon > > wrote: >> >>> On Nov 20, 2017, at 12:32 AM, David Waite via swift-evolution

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Hart via swift-evolution
> On 20 Nov 2017, at 12:34, Brent Royal-Gordon wrote: > >> On Nov 20, 2017, at 12:32 AM, David Waite via swift-evolution >> > wrote: >> >>> On Nov 20, 2017, at 1:16 AM, David Hart via swift-evolution >>>

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread Brent Royal-Gordon via swift-evolution
> On Nov 20, 2017, at 12:32 AM, David Waite via swift-evolution > wrote: > >> On Nov 20, 2017, at 1:16 AM, David Hart via swift-evolution >> > wrote: >> > > >> Moreover, Ruby allows classes to have

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Waite via swift-evolution
> On Nov 20, 2017, at 1:16 AM, David Hart via swift-evolution > wrote: > > Moreover, Ruby allows classes to have instance variables with the same name > as methods: > > class Foo > def initialize() > @bar = 5 > end > > def bar() > puts “Hello" >

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Hart via swift-evolution
For what it’s worth, the Lua Programming language also has a similar C API to Ruby. So it might be worth writing very simple glue code for the most common dynamic languages to see how the DynamicMemberLookupProtocol and DynamicCallable protocols hold up before the proposals are considered for

Re: [swift-evolution] Python Interop with Swift 4+

2017-11-20 Thread David Hart via swift-evolution
Hi Chris, I’ve had a quick look into how your proposals will allow interop with other dynamic languages. It seems that the model that you chose, where calling a function is a two-step process (getting a DynamicCallable function from a DynamicMemberLookupProtocol type) fits Python like a glove,