Head Const

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 19 04:03:01 PST 2016


On 2/19/2016 3:21 AM, Jonathan M Davis wrote:
> D is definitely in a better boat in that it's easier to find and catch problems
> with const, but it really doesn't do much more to actually guarantee that a
> const object isn't being violated. Programmers are free to do horrible things
> and mark it as @trusted,

The point of @trusted is it can be grepped for, and undergo extra scrutiny. The 
idea is to minimize @trusted sections. With C++, it's the WHOLE PROGRAM that has 
to be scrutinized.

This is ORDERS OF MAGNITUDE different.


> I'm proposing that we have something like
>
> @mutable struct S
> {
>      int i;
>      @mutable int* refCount;
>      ...
> }

This does not work for opaque types.


More information about the Digitalmars-d mailing list