[Issue 6857] Precondition contract checks should be statically bound.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 3 16:44:10 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6857
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
--- Comment #20 from Stewart Gordon <smjg at iname.com> 2012-05-03 16:45:21 PDT ---
(In reply to comment #5)
> This is incorrect. It must satisfy the precondition for A or any
> class derived from A.
The in contract is part of the API of class A. If you call a method of A with
arguments that don't satisfy this contract, you are not conforming to the API.
(In reply to comment #10)
> It isn't a bug, it is the way it is supposed to work. Nor am I
> ignoring it - I'm trying to explain it.
You're explaining the design you're copying. That's quite different from
explaining why you've chosen to copy this particular design to the letter.
(In reply to comment #19)
> (In reply to comment #16)
>> This is the issue. WHY are they done based on the virtual type?
>> Checking the contracts based on static typing would detect logical
>> errors in the calling code. Doing it based on the virtual type
>> ignores latent bugs in specific instances where they are harmless.
>> I can't understand why that's a good idea.
>
> The whole idea of polymorphism is to base things on the virtual
> type.
What are "things"?
If you mean the effect of a call, then yes. This we seem to be all agreed on.
If you mean whether a given call is legal, then you could by the same argument
insist that called method names must be resolved in the context of the virtual
type.
--
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