On Friday, 14 July 2017 at 15:39:01 UTC, Guillaume Boucher wrote:
Example 1: Polymorphism

class Bird { void fly() { ... } };
class Penguin : Bird { override void fly() @pragma(noreturn) { assert(0); } };
class EvolvedPenguin : Penguin { override void fly() { ... } };


No matter how you look at it, this code should simply not be allowed:

Bird bird = ...;
bird.fly(); // is this return or noreturn?

Penguin penguin = ...;
penguin.fly(); // is this return or noreturn?

In both cases, compiler cannot draw any conclusions about return/noreturn and thus I believe such code should not be allowed.

And if this is disallowed, a Bottom type would fit again.

Reply via email to