D is our last hope

Adam D Ruppe destructionator at gmail.com
Tue Dec 19 21:52:01 UTC 2023


On Tuesday, 19 December 2023 at 21:42:40 UTC, jmh530 wrote:
> I understand that. My point was just that still hasn't been 
> resolved.
>
> Steve suggested a separate import path flag for C imports. He 
> explained

I still say the best thing to do is to ditch the overloading of 
the `import` keyword and instead embrace the `mixin` keyword.

mixin[C](`#include<stdio.h>`);

you can now use the full file name, with .h or .c or whatever you 
want. And you can do this in context of D, meaning you can do 
things like :

@nogc {
    mixin[C](`#include<stdio.h>`);
}


And potentially use macros:

enum C_Context = mixin[C](`#define foo bar`);
mixin[C, C_Context](`use foo here`);

or something like that.



More information about the Digitalmars-d mailing list