http://d.puremagic.com/issues/show_bug.cgi?id=6856
--- Comment #12 from Don <[email protected]> 2011-11-02 17:37:44 PDT --- (In reply to comment #10) > (In reply to comment #9) > > This explicit widening of preconditions of virtual functions seems to be a > > really niche feature. > > I think it does makes some sense to be like this. You can see it as adding an > extra method to a derived class, or class implementing an interface. Yes. But in those cases you mention, the syntax for accessing the base functionality is different to the derived functionality. But here we have something different: Derived c; Base b = c; c.foo(7); // OK b.foo(7); // fail -- precondition is not widened Same function body gets used in both calls, BUT different contracts need to get called. > The > derived class adding a new method() still satisfies the interface, in the same > sense an overriden method accepting wider preconditions still satisfies the > original precondition, and the interface. Yes, it does, but why is that desirable? When do you actually want that? Only in niche cases, I think. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
