References in D

Alex Rønne Petersen alex at lycus.org
Sat Sep 15 09:18:58 PDT 2012


On 15-09-2012 17:10, Russel Winder wrote:
> On Sat, 2012-09-15 at 16:24 +0200, Alex Rønne Petersen wrote:
> […]
>> You can't really do this "carefully". One way or another, you're going
>> to break *tons* of code by removing null references.
>
> Code is not broken by a breaking change in a compiler, using the wrong
> compiler causes the differences to be exhibited. If people do not wish
> to go with the breaking change, they do not need to move to the "broken"
> compiler.
>
> There are still people using Java 1.4 because they thing all the changes
> in Java 5 were language breakages. The same will happen with Java 8.
>
> Many people consider Python 3 to be a breaking change too far, and will
> be sticking with 2.7 — or some will still continue to stay with 2.5
> since the changes introduced by 2.6 are, to them, a breakage too far.
>
> Pre C++11 and post C++11 is another example.
>
> Many people will though manage carefully the evolution of their code
> with that of their chosen compilation tool chain. Personally I amend my
> codes to fit the latest version: Java 8, Python 3.3, gcc 4.8, d 2.120,
> etc.
>
> Nothing wrong with planned breaking changes in compilation system as
> long as people know when they are coming and what the breakages are.
>

In D land, we have one compiler: 'dmd'. (And of course 'gdc' and 
'ldc2'.) This means that it's not so trivial to get the 'right' compiler 
to compile a specific source base. It's easy for e.g. Python because 
they have 'python' (2.x), 'python3' (3.x), and so on (even down to minor 
releases on some distros, if memory serves).

For this approach to be feasible with D, we'd need to start embracing 
major language versions like Python, C#, Java, etc. However, this does 
not seem to be Walter's plan with D; as far as I know, he wants D2 to be 
*the* D - the end. As such, it's probably also very unlikely that we'll 
get a --langversion switch or so.

Also keep in mind the focus on language stabilization lately.

All of the languages you mention are designed with either of two things 
in mind:

a) the compiler will have an -std switch;
b) or, multiple compilers can be installed on the same system.

There is focus on neither of those points in D's development.

So, all in all, with D's current language versioning 'model', you can't 
*realistically* change the language without breaking code. I don't agree 
with your last statement about breaking changes in the light of our 
current versioning model, but would agree with it if we did major 
language versions and made it easy to have multiple compilers installed 
and/or enhanced the compiler with a --langversion switch.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list