Stepping back and looking at constness from another angle.
Ary Manzana
ary at esperanto.org.ar
Wed Jun 6 03:11:18 PDT 2007
Carlos Santander escribió:
> Ary Manzana escribió:
> My point is, I don't think that's the purpose of documentation.
>
> There is one thing, however, and it is when everything gets carried
> away. Where do you draw the line between just documenting and actually
> implementing it as a language feature? For example, "throws" in Java,
> which is non-existent in D. Here, (almost) everyone agreed that it was
> best to leave it as documentation only. Nonetheless, the same argument I
> just applied for type-safety and const-correctness could be applied to
> "throws," so I guess it's a matter of preference or background, maybe?
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...)
More information about the Digitalmars-d
mailing list