const / in
Simen kjaeraas
simen.kjaras at gmail.com
Sat Dec 11 14:20:15 PST 2010
Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> It has definitely been suggested before that const should be the
> default, and
> some people would love that, but there's no way that it's going to
> happen in D2,
> and much as I like const, I think that it would be a huge mistake to do
> it in
> any version of D and likely any version of any C-based language. It's
> too big of
> a break with other versions of D and other C-based languages.
I'm torn about the issue. I see reasons to have const by default (or even
immutable), but having it as the 'real' default would as you say, turn
away too many programmers.
Hence, I suggest that modules may be marked default-const:
const module foo;
int n; // const int
mutable int m; // int
This could also be extended to cover pure:
pure const module foo;
Is this a good idea? No idea.
--
Simen
More information about the Digitalmars-d
mailing list