digitalmars.D.bugs - [Regression] Abstract method cannot have contracts
- Stewart Gordon (33/33) Sep 24 2004 Using DMD 0.102, Windows 98SE.
- Walter (4/7) Mar 02 2005 Well, no. The contract code goes with the function body. Perhaps in the
-
Stewart Gordon
(10/18)
Mar 23 2005
Using DMD 0.102, Windows 98SE. A 'fix' introduced in DMD 0.101 has had an apparently unexpected consequence, which I noticed when a bit of SDWF stopped compiling. ---------- abstract class Qwert { abstract int yuiop(int asdfg) in { assert (asdfg <= 100); }; } interface Zcxvb { int yuiop(int asdfg) in { assert (asdfg <= 10); } out (result) { assert (yuiop % 3 == 1); }; } ---------- D:\My Documents\Programming\D\Tests\bugs\abstract_dbc.d(5): missing body { ... } after in or out D:\My Documents\Programming\D\Tests\bugs\abstract_dbc.d(15): missing body { ... } after in or out ---------- Missing body? They're abstract, so of course there's no body. I've always assumed that contracts were supposed to be allowed in abstract/interface methods. Even if they have no effect before we have contract inheritance. Stewart.
Sep 24 2004
"Stewart Gordon" <Stewart_member pathlink.com> wrote in message news:cj0q80$2tum$1 digitaldaemon.com...I've always assumed that contracts were supposed to be allowed in abstract/interface methods. Even if they have no effect before we have contract inheritance.Well, no. The contract code goes with the function body. Perhaps in the future it could be made to work on interface methods, but not now.
Mar 02 2005
Walter wrote:"Stewart Gordon" <Stewart_member pathlink.com> wrote in message news:cj0q80$2tum$1 digitaldaemon.com...<snip> The contract code already needs to be separated from the body at compile-time in order to support contract inheritance at all. So disallowing contract code with an abstract method seems an arbitrary restriction. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on on the 'group where everyone may benefit.I've always assumed that contracts were supposed to be allowed in abstract/interface methods. Even if they have no effect before we have contract inheritance.Well, no. The contract code goes with the function body.
Mar 23 2005