Thread overview | |||||
---|---|---|---|---|---|
|
September 24, 2004 [Regression] Abstract method cannot have contracts | ||||
---|---|---|---|---|
| ||||
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. |
March 03, 2005 Re: [Regression] Abstract method cannot have contracts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "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. |
March 23, 2005 Re: [Regression] Abstract method cannot have contracts | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: > "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. <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. |
Copyright © 1999-2021 by the D Language Foundation