Header-Only Library - pragma(root)

Tove tove at fransson.se
Sun Jun 14 09:28:34 UTC 2020


On Sunday, 14 June 2020 at 08:36:50 UTC, Walter Bright wrote:
> There is much misunderstanding in the "What does 'inline' 
> mean?" thread.
>
> I've slowly come to realize that it's not about inlining at 
> all, it's about a desire for "header-only" libraries. To use a 
> header-only library, you only have to import the module for it.
>
> This works today in D if you also add the imported module to 
> the command line. But, of course, it's good to make it simpler.
>
> So, I propose the addition of `pragma(root);` which looks like:
>
> --- electron.di ---
> module electron;
> pragma(root);    // header-only library!
>

I like this feature.

Could *.di always be root?



More information about the Digitalmars-d mailing list