const?? When and why? This is ugly!

Derek Parnell derek at psych.ward
Sat Mar 7 03:45:41 PST 2009


On Sat, 07 Mar 2009 10:48:13 +0100, Lutger wrote:

> Walter Bright wrote:

>> I tend to agree that if you try to do strings the C way in D2, you'll 
>> probably find it to be frustrating experience.
 
> That is a really helpful insight. It also means string programming is a bit 
> different in D2 than in D1.

Tell me about it! When I converted Bud to D2, it was a nightmare. It took
many, many hours of edit-compile cycles to get a clean compile. Then
debugging it took ages due to still trying to think in D1 string terms,
which gave me lots of weird and wrong strings during run time. 

After a lot of trial and error, I finally groked the D2 string concept and
got on top of the issue. But I wanted to have the same source support D1
and D2, which leads to a whole new set of horrors.

The lessons I've learned from this exercise include ...
(a) Wait until D2 is stablised.
(b) Use a text macro processor if you want one source to support D1 and D2.
(c) Any project that is not a simple application, might be better
re-written with D2 than converted from D1.
(d) D2 strings are a useful idea. However, one still needs const(char)[]
and char[] types, so useful mnemonics for these is a good idea.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list