www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Will D2 be backwards compatible with D

reply Merlin Moncure <mmoncure gmail.com> writes:
Basic question: will 2.0 compiler be able to compile D1 code (library changes
not withstanding)?  If no, is there a summary of the kind of changes that will
have to be made?
Apr 01 2009
parent reply Kagamin <spam here.lot> writes:
Merlin Moncure Wrote:

 Basic question: will 2.0 compiler be able to compile D1 code (library changes
not withstanding)?  If no, is there a summary of the kind of changes that will
have to be made?

changes to what?
Apr 02 2009
parent reply Merlin Moncure <mmoncure gmail.com> writes:
Kagamin Wrote:

 Merlin Moncure Wrote:
 
 Basic question: will 2.0 compiler be able to compile D1 code (library changes
not withstanding)?  If no, is there a summary of the kind of changes that will
have to be made?

changes to what?

Changes to your code. If you run D1.0 code through D2.0 compiler, what errors will yet get? (not counting library errors)
Apr 02 2009
parent reply Trass3r <mrmocool gmx.de> writes:
Merlin Moncure schrieb:
 Changes to your code.  If you run D1.0 code through D2.0 compiler, what errors
will yet get? (not counting library errors)
 

Most probably you get errors regarding strings, since strings (esp. string literals) are invariant(char)[] in D2 and char[] in D1. Thus you should get errors when you pass a string literal to a function that wants a char[].
Apr 02 2009
parent Don <nospam nospam.com> writes:
Trass3r wrote:
 Merlin Moncure schrieb:
 Changes to your code.  If you run D1.0 code through D2.0 compiler, 
 what errors will yet get? (not counting library errors)

Most probably you get errors regarding strings, since strings (esp. string literals) are invariant(char)[] in D2 and char[] in D1. Thus you should get errors when you pass a string literal to a function that wants a char[].

The most significant breaking change is that 'const' has a completely different meaning in D2, compared to D1. Porting D1 code to D2 is mostly about inserting/removing 'const' -- most commonly in relation to strings. Most of D1 is directly compilable in D2. However, changes to libraries are more significant. Phobos2 is rapidly diverging from Phobos1. And Tango2 is non-existent.
Apr 03 2009