'in' storage class

Nathan Reed nathaniel.reed at gmail.com
Wed Sep 5 08:50:10 PDT 2007


Funog wrote:
> 'in' is equivalent to final const scope.
> I can't understand the point of making the variable 'final' if it's already 'const' ?
> 

In D 2.0, 'final' represents 'head-const', while 'const' means 
'tail-const'.  This makes a difference when talking about arrays: 
'final' will make the array reference itself const, so you can't change 
it to refer to a different array, while 'const' makes the contents of 
the array const - you can change the variable to point to another array 
or slice, but you can't edit any array through that reference.

Thanks,
Nathan Reed


More information about the Digitalmars-d-learn mailing list