preparing for const, final, and invariant

Regan Heath regan at netmail.co.nz
Mon May 21 03:53:56 PDT 2007


Regan Heath Wrote:
> It seems to me you want both of these ('scope' because the reference will persist outside the function and 'final' because the very point of 'ref' is to be able to modify the reference) except in cases where you pass it by 'ref', in which case you want neither.  

Re-reading this it appears I have made a mistake and worded it terribly to boot.  To clarify...

What I was trying to say is twofold:

1. Because we have 'ref' as an option then in the cases where we do not use 'ref' we do not need to modify the reference and therefore it should be 'final'.

2. Because the reference is not passed by 'ref' it is a copy and will not persist outside the function and therefore is 'scope'

In short, unless you use 'ref' you want 'scope final' applied to these references.

Fingers crossed I haven't made any more mistakes there.

Regan Heath



More information about the Digitalmars-d-announce mailing list