Dual D2/D1 code base

Jason House jason.james.house at gmail.com
Fri May 15 21:31:37 PDT 2009


Georg Wrede Wrote:

> Jason House wrote:
> > I don't know what made me think of it, but could a feature very
> > similar to Descent's compile-time view be used for generating D1 code
> > from D2 code? It should allow striping of const, immutable, nothrow,
> > shared, and pure from D2 code with relative ease. It obviously would
> > not solve everything, but I think it could allow Tango to use a
> > single code base... Several Tango-based D1 libraries could then
> > follow and support both D1 and D2.
> > 
> > Thoughts?
> 
> I think changing storage classes, and the like, is the easy part. And 
> writeln/writefln should be easy. But the rest is much harder.
> 

If I understand correctly, Descent's compile-time view pushed code through the front end and then walks the resulting syntax tree to regenerate the code. The ease of outputing alternate types really depends on how the front end is implemented. I wouldn't expect writeln vs. writefln to be solved by this. If this allows a simple port of Tango to D2 to be converted back to D1, then that's all the success I was hoping for. Note that doing this would bring a complete standard library to both D1 and D2. Code written to use that subset of functionality could also support D1 and D2 simultaneously. It does limit some D2 features, but that's to be expected...



More information about the Digitalmars-d mailing list