Mixin C

Paul Backus snarwin at gmail.com
Fri Mar 8 04:02:49 UTC 2024


On Friday, 8 March 2024 at 03:37:02 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> Having raw C blocks in a D file gives me concern for IDE's wrt. 
> syntax highlighting.
>
> We do have a comparable feature with inline assembly support in 
> ldc/gdc where it uses strings.
>
> I would suggest that this is the direction to go in rather than 
> a raw code block.

Yeah that's reasonable. Honestly it would barely even look 
different if you use a q{...} string:

     mixin(C) q{
         #include <stdio.h>
         printf("Hello from C!\n");
     };

I guess the lexer currently barfs on #include, but surely we can 
bend the rules on that if we need to.


More information about the dip.ideas mailing list