Be careful, though, the import expression (understandably) expects a compile-time string, which means that you can't directly use it from CTFE (e.g. to open additional files included by the IDL file you are parsing), but instead have to go back to compile-time land and then pass the contents back to CTFE in convoluted ways…

David



On 1/30/12 2:41 PM, Manu wrote:
On 30 January 2012 15:30, Vladimir Panteleev
<vladi...@thecybershadow.net <mailto:vladi...@thecybershadow.net>> wrote:

    On Monday, 30 January 2012 at 13:23:19 UTC, Manu wrote:

        Is D capable of accessing the filesystem at compile time, for
        instance, to
        load and parse an XML DOM, or some other structural metadata,
        which may be
        used to generate the associative struct and its members?
        I can think of many other uses for the technology too. It seems
        extremely
        powerful, and I'm sure it's been discussed :)


    That's what the import("filename") expression is for:
    http://dlang.org/expression.__html#ImportExpression
    <http://dlang.org/expression.html#ImportExpression>

    You'll need to approve paths for inclusion with the -J switch.


Magic! :)

Reply via email to