Migrating dmd to D?
Arlen
arlen.ng at gmx.com
Thu Feb 28 11:28:06 PST 2013
On Wed, Feb 27, 2013 at 6:37 PM, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:
> Hello,
>
>
> Walter and I have had a long conversation about the next radical thing to
> do to improve D's standing. Like others in this community, we believe it's
> a good time to consider bootstrapping the compiler. Having the D compiler
> written in D has quite a few advantages, among which taking advantages of
> D's features and having a large codebase that would be its own test harness.
>
> By this we'd like to initiate a dialog about how this large project can be
> initiated and driven through completion. Our initial basic ideas are:
>
> 1. Implement the dtoh standalone program that takes a D module and
> generates its corresponding C++ header.
>
> 2. Use dtoh to initiate and conduct an incremental port of the compiler.
> At given points throughout the code D code will coexist and link with C++
> code.
>
> 3. At a point in the future the last C++ module will be replaced with a D
> module. Going forward there will be no more need for a C++ compiler to
> build the compiler (except as a bootstrapping test).
>
> It is essential that we get support from the larger community for this.
> This is a large project that should enjoy strong leadership apart from
> Walter himself (as he is busy with dynamic library support which is
> strategic) and robust participation from many of us.
>
> Please chime in with ideas on how to make this happen.
>
>
> Thanks,
>
> Andrei
>
Having ported Boost.units to D, I can attest to this being a lot of work.
I did try translating first and then refactoring the code, but that did not
go well, mainly because of all the tricks and hacks employed when doing
template meta-programming in C++ that did not translate well at all to D.
With my first attempt I pretty much ended up with C++ code that was written
in D, and that's not what I wanted. So I had to start over, refactoring
and writing D code in D as I went. The problem with refactoring is that
once you refactor a piece, chances are that you will need to refactor
everything that depends on the code that was refactored, and that starts a
domino effect.
Of course, things are different with DMD, so translating first and then
refactoring is probably the right way to do it. But, I don't see how we
could use D's nice features without refactoring. So, I presume this is
going to be done in two phases:
Phase 1: direct translation to make sure everything works.
Phase 2: refactoring to use D's nice features.
And your three steps would be describing Phase 1.
Arlen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130228/ad5cef72/attachment.html>
More information about the Digitalmars-d
mailing list