On 19.02.2019 19:19, Kagamin wrote:
On Tuesday, 19 February 2019 at 15:30:22 UTC, Atila Neves wrote:
I keep hearing how const is nigh unusable in D, and except for ranges I litter my code with const everywhere, pretty much just as often as I used in C++.

I once spent a good amount of effort to annotate my code with pure and inout only to find a compiler bug, then I realized that annotations aren't really needed, because the collection is inherently mutable anyway (appender).

I use const all over the place too. And I made PR to other libraries to add const qualifier. Yes, it sometimes forces me to make a copy of data to mutate it - but I'm pretty sure this is the purpose of the qualifier. This helps me to catch/prevent bug. So I don't agree with people who do not use const at all. Definitely const qualifier in D is usable and is useful. The same I can say about properties - for example I use them in meta programming to detect what to serialize/process - I skip methods but serialize properties and for me this is a nice language feature.

Reply via email to