The point of const, scope, and other attributes
Walter Bright
newshound2 at digitalmars.com
Wed May 11 18:18:18 UTC 2022
On 5/11/2022 3:48 AM, IGotD- wrote:
> C# went the other way, no const parameters at all. Maybe because it doesn't make
> much sense because there is a lot of runtime violations of const underneath.
> Anyway, I like the C# aproach better because it is simpler for the programmer.
It's not simpler for someone trying to read the code. Function documentation
almost never says "by the way, this `getValue` function also tweaks the database."
> Another problem is that all this badging tend to get out of hand and it breeds
> more badges until it doesn't mean anything. For example what will happen if D
> adds a mutable attribute?
It already has a mutable attribute - nothing!
More information about the Digitalmars-d
mailing list