Head Const
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 16 02:17:05 PST 2016
On Tuesday, 16 February 2016 at 10:06:12 UTC, ZombineDev wrote:
> Another bonus to introducing the mutable keyword is the option
> to make everything immutable by default (in a future version of
> D) and allow the users to have mutable objects only if they use
> the mutable keyword.
While some folks do bring that up from time to time, I think that
it's pretty clear that that would be so restrictive that it would
risk killing D. As it is, many programmers avoid const
altogether, because it's too restrictive. Heck, ranges are
designed in such a way that they require mutation to work, and
they're everywhere.
immutable has its uses to be sure, but I don't see how it's
anything but a pipe dream to expect any version of D to be
immutable by default. For most programmers, it would be way too
annoying and way too verbose, because they'd be forced to slap
mutable on most everything.
Regardless, there isn't much point in planning for a future
version of D. We don't know what we're going to want to do at
that point, and if we're actually willing to break backwards
compatibility in a serious way, what D2 looks like doesn't really
matter much for D3. And we don't even know whether there will
ever be a D3. What matters to us now is what we do with D2 for
making it a good language now and not what we may or may not do
with a future version of the language. Planning for D3 now would
be like planning for D when working on finishing up C++98.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list