'in' storage class

Funog funog at ifrance.com
Wed Sep 5 13:46:22 PDT 2007


Nathan Reed Wrote:

> Funog wrote:
> > void testFinal(final int[] foo)
> > {
> >     foo[0] = 10;        //OK
> >     foo = new int[20];  //ERROR
> > }
> > void testConst(const int[] foo)
> > {
> >     foo[0] = 10;        //ERROR
> >     foo = new int[20];  //ERROR
> > }
> > void testFinalConst(final const int[] foo)
> > {
> >     foo[0] = 10;        //ERROR
> >     foo = new int[20];  //ERROR
> > }
> > 
> > 
> > So what is the difference between 'const' and 'final const' ?
> > 
> 
> I suppose there's no practical difference in that case since you're 
> using the transitive const.  Note that final const(int)[] foo is 
> different from const(int)[] foo though.
> 
> Thanks,
> Nathan Reed



I agree... But then, what is the point of having 'in' equivalent to 'final const scope' rather than just 'const scope' ?



More information about the Digitalmars-d-learn mailing list