DMD 2.100, bring ont he attribute soup
mee6
mee6 at lookat.me
Fri May 27 00:23:23 UTC 2022
On Thursday, 26 May 2022 at 23:25:06 UTC, Walter Bright wrote:
> On 5/26/2022 3:54 PM, deadalnix wrote:
>> Second, I expect the constraint checked by the compiler to
>> provide me with useful invariant I can rely upon. For
>> instance, if some data is immutable, and that it is really an
>> invariant in the program, then I can know this data can be
>> shared safely as nobody else is going to modify it. The
>> existence of the invariant limits my options on one axis - I
>> cannot mutate this data - while opening my option in another
>> axis - i can share this data safely without synchronization.
>>
>> If immutable instead meant immutable in most places, you you
>> can mutate it with this weird construct, then it is
>> effectively useless as a language construct, because it
>> restrict my expressiveness on one axis without granting me
>> greater expressiveness on another.
>
> Immutable means immutable in D, all the way. I've fended off
> many attempts to turn it into "logical const" and add "mutable"
> overrides. Most of the complaints about immutable and const in
> D is they are relentless and brutal, not that they don't work.
People avoid const, very easy work around, you don't hear much
about const other than to avoid it. I guess people don't want to
optionally force themselves to use something "relentless and
brutal". The argument can be made for its removal, and it would
be a boon. So much baggage like 'inout' could be removed. It
would remove complexity.
More information about the Digitalmars-d
mailing list