[Issue 6549] Implement contracts without implementation.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 12 10:07:17 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6549
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |smjg at iname.com
Severity|normal |enhancement
--- Comment #4 from Stewart Gordon <smjg at iname.com> 2012-02-12 10:07:15 PST ---
(In reply to comment #3)
> Is there any news on this? Design-by-contract in D is seriously crippled due to
> this bug.
It's an arbitrary restriction, not a bug.
http://www.dlang.org/declaration.html
Decl:
StorageClasses Decl
BasicType Declarators ;
BasicType Declarator FunctionBody
AutoDeclaration
http://www.dlang.org/function.html
FunctionBody:
BlockStatement
BodyStatement
InStatement BodyStatement
OutStatement BodyStatement
InStatement OutStatement BodyStatement
OutStatement InStatement BodyStatement
InStatement and OutStatement are part of FunctionBody, so if the function has
no body then it can't have in and out contracts.
But I entirely agree that it should be allowed. Contracts are part of the API,
not the implementation. As such, they are equally applicable to
abstract/interface methods. It could also improve contract checking in
closed-source libraries.
--
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