The point of const, scope, and other attributes

Walter Bright newshound2 at digitalmars.com
Wed May 11 18:14:48 UTC 2022


On 5/11/2022 12:21 AM, Dukc wrote:
> Regarding other attributes, I think it's good that our const/immutable/shared 
> are transitive. Otherwise the attribute soup problem we have would be even worse.

My experience with non-transitive const in C and C++ is it is more 
"documentation" than anything reliable. For example, if you're handing a 
reference to a non-trivial data structure to a function, there's no way to say 
"just read the data structure, don't change it". People schlepp a `const` on it 
anyway, but it doesn't work.


More information about the Digitalmars-d mailing list