Re: unimplemented abstract function compiles.

2018-08-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-08-12 19:29, Eric wrote: I thought it would work the same way as an interface (which must be implemented by the direct sub class, otherwise compile error). But apparently it's possible to implement an abstract function anywhere in the class hierarchy. That makes it, in this case, impossi

Re: unimplemented abstract function compiles.

2018-08-12 Thread ag0aep6g via Digitalmars-d-learn
On 08/12/2018 07:29 PM, Eric wrote: I thought it would work the same way as an interface (which must be implemented by the direct sub class, otherwise compile error). From the spec text [1], I'd also expect an error. It says: "An abstract member function must be overridden by a derived class."

Re: unimplemented abstract function compiles.

2018-08-12 Thread Eric via Digitalmars-d-learn
I thought it would work the same way as an interface (which must be implemented by the direct sub class, otherwise compile error). But apparently it's possible to implement an abstract function anywhere in the class hierarchy. That makes it, in this case, impossible to check during compile time.

Re: unimplemented abstract function compiles.

2018-08-11 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 11 August 2018 at 23:12:43 UTC, ag0aep6g wrote: On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when yo

Re: unimplemented abstract function compiles.

2018-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 08/11/2018 10:55 PM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] class I {   abstract void f(); } class C : I { } unittest {   C c = cast(C) Object.factory("C");   c.f(); } Not a bug, as far as I see. You don't

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 11:12 AM, ag0aep6g wrote: On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when you compiled. [...] E

Re: unimplemented abstract function compiles.

2018-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 08/11/2018 11:20 PM, rikki cattermole wrote: On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? [...] No bug. You forgot to throw -unittest when you compiled. [...] Error: program killed by signal 11 If th

Re: unimplemented abstract function compiles.

2018-08-11 Thread rikki cattermole via Digitalmars-d-learn
On 12/08/2018 8:55 AM, Eric wrote: Code below compiles while I would not expect it to compile. Is there a reason that this compiles? Specs are a bit lite on abstract classes. Only thing I found that would need to allow this is: "19.4 functions without bodies" https://dlang.org/spec/function.htm