On 2012-07-07 23:20, Walter Bright wrote: > I think this is potentially a big deal. > > If it can be made complete enough, I'd like to add support into D for > it, so you could do things like: > > import "stdio.h"; > > and the D compile would fork/exec Dstep, generate the corresponding .d > file, and import the .d file. How is this going to work, is it going to be an optional feature? I mean, this will add DStep (D and Clang) as dependencies to DMD. DStep is built to be used as a library, I can easily create a C API which can be used directly by DMD. No need for creating a new process. I can also make DStep give back the translate D code, no need for creating temporarily D files. BTW, how would you indicate that the header file is an Objective-C file? Since both C and Objective-C uses the same extension for header files, this is required by Clang, otherwise it will treat the file as a C file. > Some issues: > > 1. Passing macro definitions to Dstep Yeah, this will be the hardest. The main problem now is that libclang (the stable C API) doesn't have an API for handling macros. > 2. The name "Dstep" has no obvious relationship to what it does. No it does not, but I'm tired of trying to come up with cleaver names for tools and libraries. Here's the story behind the name for those who are interested: DStep started out as another project, as a D-Objective-C bridge: http:// dsource.org/ projects/dstep In that project I had a tool for converting C/Objective-c headers to D modules. This tool was a Ruby script based on BridgeSupport. This is a complete rewrite of that tool. The whole project was called DStep and the name fit among other Objective-C related names like NeXTSTEP, OpenStep and GNUStep. > 3. The -o flag is not necessary. Just "do the right thing" when you see > the filename extension. That can be easily fixed. > In fact, we could make it a general facility, where if D sees: > > import "filename.ext"; > > that it fork/exec's the program: > > ext_to_D filename.ext tmpfile.d > > and them imports tmpfile.d. -- /Jacob Carlborg