Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Dave Abrahams via swift-evolution
> On Dec 31, 2015, at 11:42 AM, Matthew Johnson wrote: > > I will continue to work on motivating examples, several of which will take > advantage of this relaxed requirement. Looking forward to it! -Dave ___ swift-evolution mailing list swift-evolu

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 31, 2015, at 11:52 AM, Dave Abrahams wrote: > > >>> On Dec 31, 2015, at 9:47 AM, Matthew Johnson wrote: >>> >>> On Dec 31, 2015, at 11:18 AM, Dave Abrahams wrote: On Dec 31, 2015, at 9:01 AM, Matthew Johnson wrote:

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 31, 2015, at 11:53 AM, Dave Abrahams wrote: > > >> On Dec 31, 2015, at 9:47 AM, Matthew Johnson wrote: >> >> In the second example here Forwarder does conform to P. The author of >> Forwarder has the flexibility to specify whether conformance is desired

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 31, 2015, at 12:02 PM, David Owens II wrote: > > >> On Dec 31, 2015, at 9:47 AM, Matthew Johnson via swift-evolution >> wrote: >> >> No. This is addressed in the proposal and the lazy collections motivating >> example I replied with last night. I don’t think i

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread David Owens II via swift-evolution
> On Dec 31, 2015, at 9:47 AM, Matthew Johnson via swift-evolution > wrote: > > No. This is addressed in the proposal and the lazy collections motivating > example I replied with last night. I don’t think it’s a good idea to require > this. Can you put your proposal on GitHub under your sw

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Dave Abrahams via swift-evolution
> On Dec 31, 2015, at 9:47 AM, Matthew Johnson wrote: > > In the second example here Forwarder does conform to P. The author of > Forwarder has the flexibility to specify whether conformance is desired > or not. There are ways to handle that, including factoring the API

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Dave Abrahams via swift-evolution
> On Dec 31, 2015, at 9:47 AM, Matthew Johnson wrote: > >> >> On Dec 31, 2015, at 11:18 AM, Dave Abrahams > > wrote: >> >>> >>> On Dec 31, 2015, at 9:01 AM, Matthew Johnson >> > wrote: >>> >>> >>> >>> Sent from my iPad >>> >>> On

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
> On Dec 31, 2015, at 11:18 AM, Dave Abrahams wrote: > >> >> On Dec 31, 2015, at 9:01 AM, Matthew Johnson > > wrote: >> >> >> >> Sent from my iPad >> >> On Dec 31, 2015, at 10:09 AM, Dave Abrahams > > wrote: >> >>> >>> -Dave >>>

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Dave Abrahams via swift-evolution
> On Dec 31, 2015, at 9:01 AM, Matthew Johnson wrote: > > > > Sent from my iPad > > On Dec 31, 2015, at 10:09 AM, Dave Abrahams > wrote: > >> >> -Dave >> >>> On Dec 31, 2015, at 7:33 AM, Matthew Johnson via swift-evolution >>> mailto:swift-evolution@swift.org>

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 31, 2015, at 10:09 AM, Dave Abrahams wrote: > > > -Dave > >>> On Dec 31, 2015, at 7:33 AM, Matthew Johnson via swift-evolution >>> wrote: >>> >>> On Dec 31, 2015, at 5:04 AM, Tino Heth <2...@gmx.de> wrote: I don’t want this thread to get d

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Dave Abrahams via swift-evolution
-Dave > On Dec 31, 2015, at 7:33 AM, Matthew Johnson via swift-evolution > wrote: > >> >> On Dec 31, 2015, at 5:04 AM, Tino Heth <2...@gmx.de > >> wrote: >> >> >>> I don’t want this thread to get distracted with memberwise initialization >> Makes sense in general, but K

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Matthew Johnson via swift-evolution
> On Dec 31, 2015, at 5:04 AM, Tino Heth <2...@gmx.de> wrote: > > >> I don’t want this thread to get distracted with memberwise initialization > Makes sense in general, but Kotlin solves those problems as a whole, and the > major benefit of their approach is that everything fits together really

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-31 Thread Tino Heth via swift-evolution
> I don’t want this thread to get distracted with memberwise initialization Makes sense in general, but Kotlin solves those problems as a whole, and the major benefit of their approach is that everything fits together really fine. But I'll skip everything that is not related to forwarding. > One

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 5:44 PM, Dave Abrahams via swift-evolution > wrote: > > >> On Dec 29, 2015, at 12:06 PM, Kevin Ballard via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> I briefly skimmed your proposal, so I apologize if you already addressed >> this, but it occurs

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Patrick R. Gili via swift-evolution
+1 Sent from my iPad > On Dec 30, 2015, at 6:56 PM, Matthew Johnson wrote: > > >> On Dec 30, 2015, at 11:33 AM, Patrick Gili >> wrote: >> >> Just finished reading your write-up. It sounds similar to the Forwardable >> module supported by the Ruby standard library >> (http://ruby-doc.org/

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 30, 2015, at 11:33 AM, Patrick Gili > wrote: > > Just finished reading your write-up. It sounds similar to the Forwardable > module supported by the Ruby standard library > (http://ruby-doc.org/stdlib-2.0.0/libdoc/forwardable/rdoc/Forwardable.html). > Is this the case? It works som

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread plx via swift-evolution
> On Dec 30, 2015, at 10:27 AM, Matthew Johnson wrote: > > >> On Dec 30, 2015, at 10:06 AM, plx via swift-evolution >> wrote: >> >> Thanks for writing this up. > > Thanks for responding with comments. > >> >> Some quick points. >> >> Firstly, I think it is best if the `init(_ forwardeeRe

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 5:25 PM, Charles Srstka wrote: > > Strong +1 on this proposal. I use Objective-C’s forwarding mechanisms quite > often in my custom view code, in order to separate the code managing the > outer view, the layout of subviews within the view, and business logic into > separ

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 30, 2015, at 10:06 AM, plx via swift-evolution > wrote: > > Thanks for writing this up. > > Some quick points. > > Firstly, I think it is best if the `init(_ forwardeeReturnValue: > Forwardee)`-style initializer be replaced by something with a > distinctly-named argument, e.g. `ini

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Patrick Gili via swift-evolution
Just finished reading your write-up. It sounds similar to the Forwardable module supported by the Ruby standard library (http://ruby-doc.org/stdlib-2.0.0/libdoc/forwardable/rdoc/Forwardable.html). Is this the case? Cheers, -Patrick Gili ___ swift-evol

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 30, 2015, at 10:06 AM, plx via swift-evolution > wrote: > > Thanks for writing this up. Thanks for responding with comments. > > Some quick points. > > Firstly, I think it is best if the `init(_ forwardeeReturnValue: > Forwardee)`-style initializer be replaced by something with a

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread plx via swift-evolution
Thanks for writing this up. Some quick points. Firstly, I think it is best if the `init(_ forwardeeReturnValue: Forwardee)`-style initializer be replaced by something with a distinctly-named argument, e.g. `init(forwardeeReturnValue value: Forwardee)`. For use with actual wrapper types the “i

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
> On Dec 30, 2015, at 5:47 AM, Tino Heth <2...@gmx.de> wrote: > > Have you looked at how this is handled in Kotlin? I hadn’t, but I did look at a paper on a forwarding preprocessor for Java that was called Jaime. The way forwarding is declared is very similar to Kotlin so it may have been a p

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 30, 2015, at 12:52 AM, Thorsten Seitz wrote: > > Thanks for proposing this, Matthew! > > Am 30. Dezember 2015 um 03:05 schrieb Matthew Johnson via swift-evolution > : > > * Why the method-based conversion syntax for return values, rather than > something

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-30 Thread Tino Heth via swift-evolution
Have you looked at how this is handled in Kotlin? Imho Jetbrains solution is quite elegant — especially as it also has a natural answer to another problem ("flexible memberwise initialization"; the whole init process is only a short chapter in the docs). Of course, their approach is different, bu

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Thorsten Seitz via swift-evolution
___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 6:10 PM, Brent Royal-Gordon > wrote: > >>> * Does it have to be a protocol? Why not also allow the concrete type of >>> the property you're forwarding to? Obviously you couldn't form a subtype >>> relationship (unless you could...), but this might be useful to reduce >>

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 5:45 PM, Charles Srstka wrote: > > On Dec 29, 2015, at 5:38 PM, Matthew Johnson > wrote: >> >> >>> On Dec 29, 2015, at 5:25 PM, Charles Srstka >> > wrote: >>> >>> Strong +1 on this proposal. I use Objective

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Brent Royal-Gordon via swift-evolution
>> * Does it have to be a protocol? Why not also allow the concrete type of the >> property you're forwarding to? Obviously you couldn't form a subtype >> relationship (unless you could...), but this might be useful to reduce >> boilerplate when you're proxying something. > > This is addressed

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Charles Srstka via swift-evolution
On Dec 29, 2015, at 5:38 PM, Matthew Johnson wrote: > > >> On Dec 29, 2015, at 5:25 PM, Charles Srstka > > wrote: >> >> Strong +1 on this proposal. I use Objective-C’s forwarding mechanisms quite >> often in my custom view code, in order to separate the code ma

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Dave Abrahams via swift-evolution
> On Dec 29, 2015, at 12:06 PM, Kevin Ballard via swift-evolution > wrote: > > I briefly skimmed your proposal, so I apologize if you already addressed > this, but it occurs to me that we could support automatic protocol forwarding > today on a per-protocol basis simply by declaring a separat

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 5:32 PM, Dave Abrahams wrote: > > >> On Dec 29, 2015, at 8:37 AM, Matthew Johnson via swift-evolution >> mailto:swift-evolution@swift.org>> wrote: >> >> Motivation >> >> Delegation is a robust, composition oriented design technique that keeps >> interface and implement

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Dave Abrahams via swift-evolution
> On Dec 29, 2015, at 8:37 AM, Matthew Johnson via swift-evolution > wrote: > > Motivation > > Delegation is a robust, composition oriented design technique that keeps > interface and implementation inheritance separate. The primary drawback to > this technique is that it requires a lot of m

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 4:29 PM, Kevin Ballard wrote: > > On Tue, Dec 29, 2015, at 01:24 PM, Matthew Johnson wrote: >> Hi Kevin, >> >> Thanks for taking time to look at the proposal. >> >> The technique you show here is not bad, but it has several deficiencies IMO >> which are addressed by th

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Charles Srstka via swift-evolution
Strong +1 on this proposal. I use Objective-C’s forwarding mechanisms quite often in my custom view code, in order to separate the code managing the outer view, the layout of subviews within the view, and business logic into separate classes, all while presenting a single, monolithic interface t

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Kevin Ballard via swift-evolution
On Tue, Dec 29, 2015, at 02:11 PM, Joe Groff wrote: > >> On Dec 29, 2015, at 1:24 PM, Matthew Johnson via swift-evolution > evolut...@swift.org> wrote: >> >> Hi Kevin, >> >> Thanks for taking time to look at the proposal. >> >> The technique you show here is not bad, but it has several >> deficienc

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Kevin Ballard via swift-evolution
On Tue, Dec 29, 2015, at 01:24 PM, Matthew Johnson wrote: > Hi Kevin, > > Thanks for taking time to look at the proposal. > > The technique you show here is not bad, but it has several > deficiencies IMO which are addressed by the solution in the proposal. > > 1. Forwarding should be an implementat

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
Sent from my iPad > On Dec 29, 2015, at 4:11 PM, Joe Groff wrote: > > >> On Dec 29, 2015, at 1:24 PM, Matthew Johnson via swift-evolution >> wrote: >> >> Hi Kevin, >> >> Thanks for taking time to look at the proposal. >> >> The technique you show here is not bad, but it has several defic

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Joe Groff via swift-evolution
> On Dec 29, 2015, at 12:06 PM, Kevin Ballard via swift-evolution > wrote: > > The downside to this is it needs to be manually declared for each protocol. > But I wager that most protocols actually aren't really amenable to forwarding > anyway. At least from a language-mechanics perspective,

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Joe Groff via swift-evolution
> On Dec 29, 2015, at 1:24 PM, Matthew Johnson via swift-evolution > wrote: > > Hi Kevin, > > Thanks for taking time to look at the proposal. > > The technique you show here is not bad, but it has several deficiencies IMO > which are addressed by the solution in the proposal. > > 1. Forward

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
> On Dec 29, 2015, at 3:08 PM, Brent Royal-Gordon > wrote: > >> I have completed a first draft of a proposal to introduce automatic protocol >> forwarding. I’m looking forward to feedback from everyone! > > Some things I don't see discussed here: > > * Does it have to be a protocol? Why not

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Matthew Johnson via swift-evolution
Hi Kevin, Thanks for taking time to look at the proposal. The technique you show here is not bad, but it has several deficiencies IMO which are addressed by the solution in the proposal. 1. Forwarding should be an implementation detail, not exposed as it is with this method. 2. As such, the ge

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Brent Royal-Gordon via swift-evolution
> I have completed a first draft of a proposal to introduce automatic protocol > forwarding. I’m looking forward to feedback from everyone! Some things I don't see discussed here: * Does it have to be a protocol? Why not also allow the concrete type of the property you're forwarding to? Obviou

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Félix Cloutier via swift-evolution
As the resident you-can-already-do-this grumpy guy, I tend to agree that most protocols aren't easily amenable to forwarding, and this solution works too. In general, I think that Swift already doesn't impose too much boilerplate, and I think that most features to reduce boilerplate would be bet

Re: [swift-evolution] [Proposal Draft] automatic protocol forwarding

2015-12-29 Thread Kevin Ballard via swift-evolution
I briefly skimmed your proposal, so I apologize if you already addressed this, but it occurs to me that we could support automatic protocol forwarding today on a per-protocol basis simply by declaring a separate protocol that provides default implementations doing the forwarding. Handling of Self r