D1 -> D2

Steven Schveighoffer schveiguy at yahoo.com
Thu Nov 18 11:37:26 PST 2010


On Thu, 18 Nov 2010 14:19:12 -0500, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Steven Schveighoffer wrote:
>> My recommendation -- when you are ready, switch wholly to D2.  Don't  
>> bother with compatibility, it's just not possible.
>
>  From what you wrote, it appears that most of the difficulties were in  
> dealing with strings. Might I suggest:
>
> 1. Replace all occurrences of char[] with string.
>
> 2. Compile to find every place that mutable strings are used.
>
> 3. Refactor the code to clearly encapsulate where mutable strings are  
> created and manipulated, and as the last step, cast them to string.

But string is not always what is desired.  It depends on the library.   
Tango uses mutable arrays everywhere because it prefers not to use the  
heap as much as possible.  For example, something might take a char[]  
buffer, and a function may pass in a stack-allocated array for the  
buffer.  Changing this to string is useless.

-Steve


More information about the Digitalmars-d mailing list