cannot modify struct with immutable members

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 2 22:33:35 PST 2015


On Sat, 03 Jan 2015 16:40:14 +1030
ted via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> I'm now taking the view that const is there for the compiler to optimise 
> code on the basis that nothing can alter it once set (and can only be set 
> on initialisation). So I see your point that it would not be used very 
> often in general defensive code - better to provide access restrictions 
> (getters) for most cases.
exactly! ;-)

> thanks again,
you're welcome. hope you will keep enjoying D, it's great. ;-)
-------------- 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-learn/attachments/20150103/b339e1f7/attachment.sig>


More information about the Digitalmars-d-learn mailing list