> http://dlang.org/deprecate.html#invariant as an alias for immutable

It's not an alias, the most recent compiler emits an error if you try to
use invariant contracts, and immutable isn't a kind of contract.

immutable is a property modifier:

immutable: http://dpaste.dzfl.pl/7e724b599640
invariant (won't compile using latest release):
http://dpaste.dzfl.pl/102c5c5adef5

> Isn't invariant good enough?

Good enough for us, yeah.

Cheers
Joe

On Wed, Feb 11, 2015 at 8:18 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> Hi Joe,
>
> On Wed, Feb 11, 2015 at 5:02 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
>
>> On Wed, Feb 11, 2015 at 4:54 PM, Joe Watkins <pthre...@pthreads.org>
>> wrote:
>>
>>> So it turns out that invariant is already deprecated in D, they have
>>> dropped it in favour of immutable properties.
>>>
>>> I guess I'll have to install an old version, or try to extract
>>> everything we need from their obviously outdated documentation ...
>>>
>>
>> That's too bad.
>> Eiffel uses invariant.
>>
>> https://docs.eiffel.com/book/method/et-design-contract-tm-assertions-and-exceptions
>>
>
> http://dlang.org/deprecate.html#invariant as an alias for immutable
>
> I  think D folks would like to be more strict. Object is great, but state
> management can be complex.
> I like immutable also since it prevents modification by mistake. I'm not
> sure if we should go for it
> without having invariant. Even if we have invariant, we may have immutable
> object/scalar in the future.
> Both are good.
>
> Isn't invariant good enough? I don't think Eiffel will drop invariant
> support in favor of immutables.
>
> Regards,
>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>

Reply via email to