Re: [swift-evolution] Add code to super methods.

2016-11-30 Thread Aron Lindberg via swift-evolution
While I agree with most of your points Dave, I think forgetting to call super is very much a (hard to debug) real world problem today. Especially new developers seems unsure or likely to forget to call super when it is required. I think my point is this; When you subclass code you have not

Re: [swift-evolution] Add code to super methods.

2016-11-30 Thread Tino Heth via swift-evolution
> “this method is private but overridable,” +1 ;-) It would make the language more orthogonal — but I'm afraid this option died when "open" was added, and I have to admit that it would make things complicated as well: Methods that shouldn't be called directly (like UIView.draw and

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Dave Abrahams via swift-evolution
on Tue Nov 29 2016, Michael Ilseman wrote: >> On Nov 28, 2016, at 7:22 PM, Dave Abrahams via swift-evolution >> wrote: >> >> >> on Thu Nov 24 2016, Michael Ilseman wrote: >> > On Nov 17, 2016, at 2:54 AM, Tino Heth via

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Dave Abrahams via swift-evolution
on Tue Nov 29 2016, Goffredo Marocchi wrote: >> On 29 Nov 2016, at 17:33, Jeremy Pereira via swift-evolution >> wrote: >> >> >>> On 29 Nov 2016, at 16:55, Aron Lindberg via swift-evolution >>> wrote: >>> > >>> While I agree with most

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Goffredo Marocchi via swift-evolution
> On 29 Nov 2016, at 17:33, Jeremy Pereira via swift-evolution > wrote: > > >> On 29 Nov 2016, at 16:55, Aron Lindberg via swift-evolution >> wrote: >> >> While I agree with most of your points Dave, I think forgetting to call >> super

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Joe Groff via swift-evolution
> On Nov 28, 2016, at 7:22 PM, Dave Abrahams via swift-evolution > wrote: > > > on Thu Nov 24 2016, Michael Ilseman wrote: > >>> On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution >> wrote: >>> >>> An

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Michael Ilseman via swift-evolution
> On Nov 28, 2016, at 7:22 PM, Dave Abrahams via swift-evolution > wrote: > > > on Thu Nov 24 2016, Michael Ilseman wrote: > >>> On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution >> wrote: >>> >>> An

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Jeremy Pereira via swift-evolution
> On 29 Nov 2016, at 16:55, Aron Lindberg via swift-evolution > wrote: > > While I agree with most of your points Dave, I think forgetting to call super > is very much a (hard to debug) real world problem today. I don’t. I’ve done it a few times but I don’t

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Aron Lindberg via swift-evolution
While I agree with most of your points Dave, I think forgetting to call super is very much a (hard to debug) real world problem today. Especially new developers seems unsure or likely to forget to call super when it is required. I think my point is this; When you subclass code you have not

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Tino Heth via swift-evolution
> Why two, and why empty? UIViewController would supply its own empty default > implementation. The before/after pair: viewWillAppear would need a call to "subclassViewWillAppear" (which would be empty in the declaring class, and need a subsubclassViewWillAppear where it is overriden…) — and

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Dave Abrahams via swift-evolution
> On Nov 29, 2016, at 1:48 AM, Tino Heth <2...@gmx.de> wrote: > >> Methods that need to be called when they are overridden are >> almost always a result of poor design. > Without an explanation or data to back this statement, it's hard to argue > about it, and I won't make random shots. > >

Re: [swift-evolution] Add code to super methods.

2016-11-29 Thread Tino Heth via swift-evolution
> Methods that need to be called when they are overridden are > almost always a result of poor design. Without an explanation or data to back this statement, it's hard to argue about it, and I won't make random shots. But as a matter of fact, we have to deal with methods which require the

Re: [swift-evolution] Add code to super methods.

2016-11-28 Thread Dave Abrahams via swift-evolution
on Thu Nov 24 2016, Michael Ilseman wrote: >> On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution > wrote: >> >> An equivalent of "NS_REQUIRES_SUPER" (hopefully with a better name ;-) has >> been requested several > times, but

Re: [swift-evolution] Add code to super methods.

2016-11-28 Thread Tino Heth via swift-evolution
> 1) Unless you know exactly what a subclass should do, you can not make > assumptions about when a subclass should call its super implementation. afaics, the majority agrees on this > 2) I think it would be desirable if the default behavior is that a subclass > is expected to call super in

Re: [swift-evolution] Add code to super methods.

2016-11-25 Thread Kevin Nattinger via swift-evolution
I agree. An NS_REQUIRES_SUPER equivalent was on my list of things to propose during stage 2, and I don't see a reason to enforce order. > On Nov 25, 2016, at 04:42, Tino Heth via swift-evolution > wrote: > > >> What are your thoughts on this? >> >> Just to throw

Re: [swift-evolution] Add code to super methods.

2016-11-25 Thread Tino Heth via swift-evolution
> What are your thoughts on this? > > Just to throw out a strawman: > > // Warn if override doesn’t begin with “super.foo()” > __attribute(swift_requires_super_call_at_begin) > > // Warn if override doesn’t end with “super.foo()” > __attribute(swift_requires_super_call_at_end) I myself

Re: [swift-evolution] Add code to super methods.

2016-11-24 Thread Michael Ilseman via swift-evolution
> On Nov 17, 2016, at 2:54 AM, Tino Heth via swift-evolution > wrote: > > An equivalent of "NS_REQUIRES_SUPER" (hopefully with a better name ;-) has > been requested several times, but never got the momentum it deserves. > Considering the current confusion

Re: [swift-evolution] Add code to super methods.

2016-11-20 Thread Haravikk via swift-evolution
> On 20 Nov 2016, at 16:00, Tino Heth <2...@gmx.de> wrote: > > >> I'm not sure I follow your meaning on omission; I quite like Sean's >> suggestion of having an override(before) or override(final) in the >> sub-class, this way the call is explicitly auto-generated. I think having it >> be

Re: [swift-evolution] Add code to super methods.

2016-11-20 Thread Tino Heth via swift-evolution
> I'm not sure I follow your meaning on omission; I quite like Sean's > suggestion of having an override(before) or override(final) in the sub-class, > this way the call is explicitly auto-generated. I think having it be added > automatically in the regular override case could be a bit

Re: [swift-evolution] Add code to super methods.

2016-11-20 Thread Haravikk via swift-evolution
> On 19 Nov 2016, at 17:08, Tino Heth <2...@gmx.de> wrote: > > I still thing that the naming is one of the hardest parts: > Imho "@super" just feels wrong — the word has already a meaning, and it > should only be used when referring to the parent class (here, it is a > restriction/hint for

Re: [swift-evolution] Add code to super methods.

2016-11-19 Thread Mustafa Sabur via swift-evolution
Hi all, The most important part is that it should be easy to understand even for beginning developers. Imo the moment someone have to look it up in the docs to understand it, is the moment it has failed to serve its purpose. I just don't like the fact that you have to use the override keyword

Re: [swift-evolution] Add code to super methods.

2016-11-19 Thread Tino Heth via swift-evolution
I still thing that the naming is one of the hardest parts: Imho "@super" just feels wrong — the word has already a meaning, and it should only be used when referring to the parent class (here, it is a restriction/hint for subclasses). The best I can think of would be @extend (because it is about

Re: [swift-evolution] Add code to super methods.

2016-11-19 Thread Haravikk via swift-evolution
> On 16 Nov 2016, at 22:37, Sean Heber via swift-evolution > wrote: > > That could be kind of neat - perhaps a syntax more like this so that there > isn’t another bare keyword: > > override(after) func viewDidLoad() { > } > > and: > > override(before) func

Re: [swift-evolution] Add code to super methods.

2016-11-19 Thread arkadi daniyelian via swift-evolution
+1; if existed, i would use this feature instead of 'override' 90% of the time. It also allows the superclass to define where to call 'super.method()' - at top or bottom of the method; although im not sure whether or not that will complicate method body of superclass with additional syntax. >

Re: [swift-evolution] Add code to super methods.

2016-11-17 Thread Christopher Kornher via swift-evolution
If memory serves: the CLOS Metaobject Protocol had features like this. This might be good read if you are considering writing a proposal for this. (Dylan Lives! :) ) https://en.wikipedia.org/wiki/The_Art_of_the_Metaobject_Protocol

Re: [swift-evolution] Add code to super methods.

2016-11-16 Thread Jay Abbott via swift-evolution
Hi Mustafa, This is an interesting idea. The wording needs to be clear that it is not adding/injecting any code into the super-class. I would call it something like a cascading or chained method - there may be a better name and probably already is, because deinit already behaves in a similar way

Re: [swift-evolution] Add code to super methods.

2016-11-16 Thread Mustafa Sabur via swift-evolution
Mustafa Sabur Yes I was talking about the override(before/after) like Sean. I don’t think it would make sense to actually extend some method, since the caller might not know that it happend. I can see some problems now and im going to try to find the old discussions. Thank you. Mustafa

Re: [swift-evolution] Add code to super methods.

2016-11-16 Thread Adrian Zubarev via swift-evolution
At first glance I though about this: // Module A open class X { open func b() {} } // Module B class Y : X { addinto func b() { explodeExploit() } } class Z : X {} Z().b() // does this also call my `explodeExploit` :D ? Are you speaking of code injection of a sugar

Re: [swift-evolution] Add code to super methods.

2016-11-16 Thread Sean Heber via swift-evolution
All that said, there is a slight flaw here which is - what happens if you want to alter the input to super’s method in your override? That might be a deal-breaker. l8r Sean > On Nov 16, 2016, at 4:37 PM, Sean Heber wrote: > > That could be kind of neat - perhaps a syntax

[swift-evolution] Add code to super methods.

2016-11-16 Thread Mustafa Sabur via swift-evolution
Hallo, I have a very simple suggestion. And I’m not very sure then it haven’t been discussed already, so I’m sorry if that is the case. I would like to see the ability to just add code to base methods instead of overriding it and calling supers method. So basically an extension for methods.