Postblit bug

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 17 07:36:30 PDT 2014


On Fri, 17 Oct 2014 14:18:30 +0000
monarch_dodra via Digitalmars-d <digitalmars-d at puremagic.com> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141017/db753193/attachment-0001.sig>


More information about the Digitalmars-d mailing list