const after initialization / pointers, references and values

Vicente via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 22 11:21:05 PDT 2014


First of all thanks for your replies, they are useful.

@Philippe:
A pure function is ok for initializing "default_nodes" but not 
for "nodes" because a pure function can't read a file.
The "static this" has the problem it needs know the initializer 
at compile time but I wanted to choose the initializer at run 
time.
I know "default_nodes" can be changed to immutable, but then it 
will require an explicit cast to remove the immutability.
The final class may be a good point, I'll try this one.

@Jakob:
Thank you, but I'll go with Philippe's suggestion.

@Wyatt:
Certainly ref parameters help a lot, but I'm trying to get a 
"Node" by returning (a reference to) it. Does the ref keyword 
apply to the return type?
Next time I'll post to D.learn, sorry for misplacing my question.

Regards,
   Vicente.


More information about the Digitalmars-d mailing list