[Issue 6856] Absence of in contract (precondition) on override of method that has one is badly designed
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 22 11:43:59 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6856
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Absence of in() contract |Absence of in contract
|(precondition) should mean |(precondition) on override
|"use default precondition" |of method that has one is
|instead of "ignore |badly designed
|inherited in() contracts" |
--- Comment #32 from Stewart Gordon <smjg at iname.com> 2013-01-22 11:43:54 PST ---
(In reply to comment #31)
> Is really hard to debug a problem where you think some
> preconditions are met (because the code say so), but they really
> aren't.
But the same applies to such a method in a base class where the override does
have an explicit in contract. So if that's a valid reason, then it shouldn't
be possible to override in contracts at all.
But if we implemented this change, it would lead to confusion and fragility as
the legal inputs to a method depend on whether it overrides one with an in
contract. Even with issue 3836 done and dusted, it can be annoying to have to
walk up the class hierarchy to ascertain what the in contract of a method is,
even whether it has a in contract at all.
Maybe the right course of action is to _require_ an explicit in contract if the
superclass defines one. Since there are alternative ways to remove this
(mis)feature, I'm tweaking the summary line.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list