Thesis on metaprogramming in D

Daniel Keep daniel.keep+lists at gmail.com
Thu Nov 30 02:59:24 PST 2006


Bruno Medeiros wrote:
> Daniel Keep wrote:
> 
>>  > def sr = System.IO.StreamReader ("SomeFile.txt");
>>
>> Immutable run-time variables.  You can assign anything to them, and 
>> then it can't change.  AFAIK, D's const doesn't let you do that.
>>
> 
> What's the difference from C# and Java's 'final'? Is the variable 
> transitively unchangeable, or just the immediate value?
> 

I'm not really sure what 'transitively unchangeable' means... >_<

Firstly, isn't 'final' just used for class members?  This is used for 
local variables (or members, if I remember correctly).  As for the 
second sentence, it's immutable storage.  So you can't change what's 
stored in the variable, but if you've stored a reference, then you can 
mutate what's being referenced.

	-- Daniel



More information about the Digitalmars-d mailing list