Enhancement on `export` symbol
Hipreme
msnmancini at hotmail.com
Fri Mar 14 15:56:18 UTC 2025
On Friday, 14 March 2025 at 12:07:00 UTC, Johan wrote:
> On Friday, 14 March 2025 at 02:46:08 UTC, Richard (Rikki)
> Andrew Cattermole wrote:
>> https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1045.md#export-annotation
>
> My intuition says that it'll be more broadly useful if
> attributes can be combined and aliased.
> Something like this:
>
> ```
> version(X) {
> // some arbitrary list of attributes
> alias attribs = AliasSeq!(export, extern(C),
> ldc.attributes.weak);
> } else {
> // some arbitrary list of attributes
> alias attribs = AliasSeq!(extern(D), ldc.attributes.hidden);
> }
>
> @attribs
> void foo() {}
> ```
>
> You can already do this for the LDC attributes (because they
> are implemented as magic types), but not for D core language
> attributes.
>
> -Johan
Seconded. I believe having those core language attributes
transformed into magic types would definitely solve a long
standing issue on the language and would make more C/C++
behaviors (such as `#define dllimport`) available in the language.
More information about the Digitalmars-d
mailing list