January 22, 2013 [Issue 6856] Absence of in() contract (precondition) should mean "use default precondition" instead of "ignore inherited in() contracts" | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6856 Leandro Lucarella <leandro.lucarella@sociomantic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #31 from Leandro Lucarella <leandro.lucarella@sociomantic.com> 2013-01-22 07:24:33 PST --- (In reply to comment #28) > Not sure why this wasn't flagged as INVALID before. But now that the summary line's changed and some comments to the effect of it have been posted, it's essentially an enhancement request. But it'll probably be rejected because the code breakage that would result. The line between a fix and an enhancement here is very thin. As other people pointed out, in contract inheritance as they are are not only useless, but extremely dangerous, because they give a false sense of security. Is really hard to debug a problem where you think some preconditions are met (because the code say so), but they really aren't. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 22, 2013 [Issue 6856] Absence of in contract (precondition) on override of method that has one is badly designed | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6856 Stewart Gordon <smjg@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@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: ------- |
Copyright © 1999-2021 by the D Language Foundation