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
> “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
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
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
> 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
> 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
> 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
> 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
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
> 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
> 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.
>
>
> 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
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
> 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
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
> 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
> 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
> 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
> 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
> 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
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
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
> 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
+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.
>
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
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
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
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
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
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.
30 matches
Mail list logo