digitalmars.D - The state of contract programming in D
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (29/29) Mar 04 2012 Hi,
-
Stewart Gordon
(8/10)
Mar 05 2012
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (9/21) Mar 06 2012 Shouldn't invariant as a type modifier be deprecated once and for all? I...
- Stewart Gordon (13/17) Mar 06 2012 It already is deprecated. Download a current DMD version and see for yo...
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (7/28) Mar 06 2012 I totally didn't think of that. Thanks!
- deadalnix (2/8) Mar 06 2012 100% agreed !
Hi, What with D's contract programming getting publicity, I think it's high time we made the implementation match the documentation (and TDPL). Just a 'few' contract-related issues: * http://d.puremagic.com/issues/show_bug.cgi?id=6857 * http://d.puremagic.com/issues/show_bug.cgi?id=7584 * http://d.puremagic.com/issues/show_bug.cgi?id=6549 * http://d.puremagic.com/issues/show_bug.cgi?id=6856 * http://d.puremagic.com/issues/show_bug.cgi?id=7337 * http://d.puremagic.com/issues/show_bug.cgi?id=5039 * http://d.puremagic.com/issues/show_bug.cgi?id=7517 * http://d.puremagic.com/issues/show_bug.cgi?id=519 More subtle issues: * http://d.puremagic.com/issues/show_bug.cgi?id=2350 * http://d.puremagic.com/issues/show_bug.cgi?id=4995 Syntactical issues/enhancements: * http://d.puremagic.com/issues/show_bug.cgi?id=6415 * http://d.puremagic.com/issues/show_bug.cgi?id=5038 * http://d.puremagic.com/issues/show_bug.cgi?id=6453 The issues I personally see as most important are related to contract inheritance and contracts on functions without a body. Additionally, I think that dropping the need for parentheses on invariant declarations would be a good idea, such that it feels more like unittest declarations. Furthermore, the ability to declare multiple invariants is essential for mixins and meta-programming in general. (Many of the issues have pull requests pending review.) Thoughts? I think we need to figure out most of these before 2.059... -- - Alex
Mar 04 2012
On 05/03/2012 04:26, Alex Rønne Petersen wrote: <snip>Additionally, I think that dropping the need for parentheses on invariant declarations would be a good idea, such that it feels more like unittest declarations.<snip> It can't be done at the moment, because invariant is also the old name for immutable. Indeed, the brackets were introduced to distinguish between the two meanings, though it would have been better to introduce a new keyword in the first place rather than create a new meaning of invariant that required a change to existing syntax. Stewart.
Mar 05 2012
On 05-03-2012 11:46, Stewart Gordon wrote:On 05/03/2012 04:26, Alex Rønne Petersen wrote: <snip>Shouldn't invariant as a type modifier be deprecated once and for all? I mean, immutable has existed for a long time now... Also, just so we're on the same page here, you mean the parentheses, right? If so, I'm not sure I quite understand where the problem arises. Could you elaborate? Thanks! -- - AlexAdditionally, I think that dropping the need for parentheses on invariant declarations would be a good idea, such that it feels more like unittest declarations.<snip> It can't be done at the moment, because invariant is also the old name for immutable. Indeed, the brackets were introduced to distinguish between the two meanings, though it would have been better to introduce a new keyword in the first place rather than create a new meaning of invariant that required a change to existing syntax. Stewart.
Mar 06 2012
On 06/03/2012 15:19, Alex Rønne Petersen wrote: <snip>Shouldn't invariant as a type modifier be deprecated once and for all? I mean, immutable has existed for a long time now...It already is deprecated. Download a current DMD version and see for yourself. But how does this help? The ambiguity isn't gone until this use of invariant is removed from the language/compiler completely.Also, just so we're on the same page here, you mean the parentheses, right? If so, I'm not sure I quite understand where the problem arises. Could you elaborate?invariant { int id; char[] name; } Is this a block of class-level invariant member declarations, or a class invariant that does nothing but declare two local variables? Since D2's early days it has dealt with it by using invariant() for the latter. Stewart.
Mar 06 2012
On 06-03-2012 16:44, Stewart Gordon wrote:On 06/03/2012 15:19, Alex Rønne Petersen wrote: <snip>To clarify: I meant remove the feature entirely.Shouldn't invariant as a type modifier be deprecated once and for all? I mean, immutable has existed for a long time now...It already is deprecated. Download a current DMD version and see for yourself. But how does this help? The ambiguity isn't gone until this use of invariant is removed from the language/compiler completely.I totally didn't think of that. Thanks! I wonder if we have any plans for when invariant as a type modifier will be removed entirely... -- - AlexAlso, just so we're on the same page here, you mean the parentheses, right? If so, I'm not sure I quite understand where the problem arises. Could you elaborate?invariant { int id; char[] name; } Is this a block of class-level invariant member declarations, or a class invariant that does nothing but declare two local variables? Since D2's early days it has dealt with it by using invariant() for the latter. Stewart.
Mar 06 2012
Le 05/03/2012 05:26, Alex Rønne Petersen a écrit :The issues I personally see as most important are related to contract inheritance and contracts on functions without a body. Additionally, I think that dropping the need for parentheses on invariant declarations would be a good idea, such that it feels more like unittest declarations. Furthermore, the ability to declare multiple invariants is essential for mixins and meta-programming in general.100% agreed !
Mar 06 2012