To further explain what I mean:

struct A if (!is(this == immutable) && !is(this == shared))
{
}

shared a = A() // error
auto a = A() // ok
immutable a = A() // error
const a = A() // ok

Fake syntax above of course.

I was thinking about this because I read a few posts about const, and approaching it via allowing an object to define a head mutable version of itself (see post in general forum by Simon for details [1])

And there're few constructs like RefCounted which don't make sense with an immutable qualifier.

And then there're situations where a mutable version does not make sense (I think this would be a much bigger application), ie: handles, resource identifiers, application configuration details, etc.

[1] https://forum.dlang.org/thread/cpxfgdmklgusodqou...@forum.dlang.org

Reply via email to