Purpose of template DECLARE_HANDLE in druntime

Seb seb at wilzba.ch
Thu Jan 31 23:32:30 UTC 2019


On Thursday, 31 January 2019 at 20:51:37 UTC, Andre Pany wrote:
> Hi,
>
> I noticed in druntime this template is used often:
>
> package template DECLARE_HANDLE(string name, base = HANDLE) {
>     mixin ("alias " ~ base.stringof ~ " " ~ name ~ ";");
>
> The disadvantage is, IDEs like IntelliJ are not able to find 
> the symbols using this template e.g.
> mixin DECLARE_HANDLE!("SC_HANDLE");
>
> What is the benefit of this template?
> Why can't we just use
> alias HANDLE SC_HANDLE;
>
> Kind regards
> Andre

Have you tried changing it to alias and check whether the 
testsuite still passes?
Druntime is a bit old, so I wouldn't be too surprised if this is 
an old relict.


More information about the Digitalmars-d-learn mailing list