3 ms·
> It appears the correct action would have been to use <code>override func greet() { print("sup") }</code>. That actually doesn't work because the greet functi
by joeblau 8y ago
> It appears the correct action would have been to use <code>override func greet() { print("sup") }</code>.
That actually doesn't work because the greet function is implemented on an extension. You can only override class functions.
- anon180719 8y agoOh, that's definitely weird then. Is there an RFC to have that fixed in some way?
- joeblau 8y agoI don't think there is. I think the code is functioning as expected — it's just written in a super confusing way. What should probably happen is that the compiler should throw an error about redefining a function in a super classes extension. I'm not a compiler engineer but a check for that seems like it would be intensive unless that information is codified in the AST somehow.
- anon180719 8y agohmph. I agree, the compiler should probably not let you compile in that case. Funny enough this reminds me of "responder chain politics" in dynamically typed languages with duck typing.
- slavapestov 8y agoIt's a bug - https://bugs.swift.org/browse/SR-103 https://bugs.swift.org/browse/SR-103