preparing for const, final, and invariant
Daniel Keep
daniel.keep.lists at gmail.com
Fri May 18 12:29:49 PDT 2007
Frits van Bommel wrote:
> Daniel Keep wrote:
>> // Invariant, so a reference to it is fine
>> char[] value(invariant char[] v)
>> {
>> _value = v;
>> return v;
>> }
>
> But a mutable reference to it shouldn't be fine. So IMHO this should
> fail because you're trying to return an invariant char[] as a mutable
> char[]...
*grumbles* Fine, Mr. Pick On My Mistakes...
> invariant char[] value(invariant char[] v)
> {
> _value = v;
> return v;
> }
There, all better now? :)
-- Daniel
--
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
http://xkcd.com/
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d-announce
mailing list