More D on reddit (DrBartoz comment)

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Aug 4 12:02:49 PDT 2008


Walter Bright wrote:
> Andrei's presentation:
> 
> http://www.reddit.com/r/programming/info/6sv8d/comments/
> 

DrBartoz commented:

"We thought about letting the compiler figure out most of the const and 
invariant qualifiers in D (you'd specify them only in strategic places). 
The problem is, this would require whole-program analysis. When function 
f1 in module M1 calls function f2 in module M2, and they pass through an 
argument by reference, you have to analyze f2 before you can decide if 
f1 may declare this argument const or invariant. Although D has access 
to regular modules during compilation, the same is not true about 
libraries. If everybody agreed to ship libraries with their sources, a 
lot more would be possible."

Why would the whole source code the library be needed for that? Isn't it 
necessary only for the library API to be well-specified in terms of it's 
const semantics?



-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list