The state of contract programming in D

Alex Rønne Petersen xtzgzorex at gmail.com
Tue Mar 6 08:09:45 PST 2012


On 06-03-2012 16:44, Stewart Gordon wrote:
> 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.

To clarify: I meant remove the feature entirely.

>
>> 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.

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...

-- 
- Alex


More information about the Digitalmars-d mailing list