Stepping back and looking at constness from another angle.

BCS BCS at pathlink.com
Wed Jun 6 12:21:50 PDT 2007


Ary Manzana wrote:
 > Yes, you're right. Your analogy is great. I think I was too tired
 > yesterday and some of my neurons weren't working well.
 >
 > Anyway, I'd like to see some real-world examples where const avoids
 > bugs. Because if those examples don't exist, then the keywords are
 > there just for compiler optimization.
 >
 > (BTW, I would have liked to have throws specified in functions... when
 > programming in .Net, I just don't know what exceptions to expect while
 > calling a function like File.open, for example. Of course, this is a
 > trivial example, it's sure IOException, but with other classes it's
 > not that obvious...)

Actually, I think that this should go the other way, the language should 
be constructed in such a way that things like throws can be trivially 
found by static code analysis. It should be easy to build a tool that 
can look at a code base and answer that kind of question.



More information about the Digitalmars-d mailing list