D1, D2 and the future of libraries

Nick Sabalausky a at a.a
Sun Jan 22 13:48:51 PST 2012


"Stewart Gordon" <smjg_1998 at yahoo.com> wrote in message 
news:jfh9bb$2v3$1 at digitalmars.com...
> So far, everyone who's replied is supporting only D2.  A few more 
> questions:
>
> Did you previously write libraries for D1?
>

Yes. Made the switch about a year, year and a half ago.

> If so:
>
> - Did you find translating the code straightforward, or are there bits 
> that you found a challenge?
>

Tango -> Phobos2 took a bit of time and some elbow grease, but the only real 
challenges were a few things I was using that weren't in Phobos2 (at least 
not at the time). Some of the code actually become much simpler due to 
Phobos's straightforward nature versus Tango's Java-like design.

D1->D2 was quick and easy. There aren't too many breaking changes, and you 
don't have to really D2-ify code just to make it work in D2. (I was annoyed 
though that UFCS was (and still is) much more broken in D2 than D1. That's 
always been one of my favorite features.)

I had been using xfBuild which turned out not to work on D2 code (never was 
sure if it was xfBuild's fault or DMD's, though). But I quickly discovered 
and switched to RDMD which I like better now anyway (after having fixed the 
major issues it used to have).

The conversion certainly wasn't trivial, but all in all, it was much easier 
than I had expected.


> - What triggered you to switch?  For example, D2 just being there, signs 
> that D2 is stabilising, the announcement of D1's forthcoming end, 
> stumbling over a limitation of D1....
>

There were some killer features in D2 I was chomping at the bit for:

- *Actual* constness (not even necessarily transitive const, although that 
is nice. Just simply *having* real const/immutable *at all*).

- String literals are dynamic arrays instead of static array. So no need to 
be slicing them all the time. For instance, no more of this nonsense: 
["string1"[], "another string"]. 'Course, that's another related benefit: 
Types of certain expressions determined by best common type instead of "the 
exact type of the first item".

- Traits. God, it's nice to have traits now. Killer feature for 
metaprogramming.

I think those were the main ones. There may have been more, but I've gotten 
so used to D2 I can't remember what D1's limitations were anymore.




More information about the Digitalmars-d mailing list