On Fri, 17 Oct 2014 14:18:30 +0000 monarch_dodra via Digitalmars-d <[email protected]> wrote:
> To be honest, I think people use "const" way too much in D. It's > *not* the C++ head const you can use anywhere. It's really just > the "base" attribute between mutable and immutable data. In > particular, due to the transitive nature of const, any time you > use const it means "you can't modify this, or anything produced > or acquired from this, ever". It's usually not what people think > they are signing for... > > When it makes little sense to have your type as immutable, then I > don't think you should bother much const is a nice way to make sure that your data will not be modified. it needs some time to adjust your head to the fact that "const is const all way down to the bytes", but then it's nice. yet i still missing c++-like const, which will not try to eat everything underneath. i.e. a way to tell compiler "this field cannot be modified, but the data it points to can be changed". this will let me to get rid of annoying getters.
signature.asc
Description: PGP signature
