D safety! New Feature?
H.Loom via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 5 08:58:47 PDT 2016
On Thursday, 4 August 2016 at 18:22:52 UTC, Mark "J" Twain wrote:
> Marking a widget immutable is not the same as having an
> ImmutableWidget. Can you see the difference?
Yes, you're thinking here of logical vs physical immutability.
> I assure you there is. The immutable keyword only prevents data
> manipulation, it does not change the interface. For simple
> primitives, there is not much difference, but for larger
> complex types, the immutable keyword doesn't cut it.
>
> immutable Queue!int q1;
> ImmutableQueue!int q2;
I don't get you well because D has actually the ability to use
immutable as part of the type. This feature is called the type
constructors.
immutable Queue : attribute or storage class
immutable(Queue): part of type
More information about the Digitalmars-d
mailing list