What guarantees does D 'const' provide, compared to C++?
Chris Cain
clcain at uncg.edu
Thu Aug 16 18:50:01 PDT 2012
On Friday, 17 August 2012 at 01:43:03 UTC, Mehrdad wrote:
> Isn't that kinda useless, if it tells you nothing about the
> object itself?
Not sure what your point is. It tells you enough about how you
work with that "object itself" and sets (real) boundaries which
is unlike C++'s const which tells you truly nothing. Seems pretty
useful in my eyes. C++'s const is the thing that's really useless.
It's an abstraction, and like all abstractions, you don't
necessarily get a perfect understanding of the bits and bytes and
where they are and how they're going to function. But it does
give you more reasoning ability about your code if used properly.
Plus don't forget that it allows you to use the same code for
immutable and mutable objects, which is extremely valuable.
More information about the Digitalmars-d
mailing list