Stick a fork in it

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed May 9 20:55:21 PDT 2007


Walter Bright wrote:
> Chris Nicholson-Sauls wrote:
>> Actually, that'll be 'final'.  The new 'invariant' will mean "this 
>> *data* absolute does not change", and the new 'const' will mean "this 
>> is an *immutable view* into data owned by other code, which *may* 
>> change".  (If I'm remembering/understanding right.)
> 
> You're right.

Which gets me to thinking: will const parameters be implicitly passed by referance?  Given 
something like (contrived):

<code>
import std.stdio;

void main () {
   int i = 0;

   void inc () { ++i; }

   void foo (const int x) {
     write(x);
     inc();
     write(x);
   }

   foo(i);
}
</code>

Should I expect to see it output 01 or 00?

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list