Thread overview
Renamed but non-selective import?
Jan 12, 2021
cc
Jan 12, 2021
ag0aep6g
Jan 12, 2021
cc
January 12, 2021
Is it possible to import all symbols of a module, while renaming just one of them?  It seems like doing an import with renaming automatically makes it selective.
In the example below, I'd prefer not to have to use the fully qualified name for mymodule.MSG every time e.g.:

import core.sys.windows.windows;
import mymodule; // contains a struct named MSG
Error: `core.sys.windows.winuser.MSG` ... conflicts with `mymodule.MSG`

vs

import core.sys.windows.windows : winMSG = MSG; // this leaves out other symbols
Error: undefined identifier `HWND`
Error: undefined identifier `LPCSTR`

January 12, 2021
On 12.01.21 21:09, cc wrote:
> import core.sys.windows.windows;
> import mymodule; // contains a struct named MSG
> Error: `core.sys.windows.winuser.MSG` ... conflicts with `mymodule.MSG`
> 
> vs
> 
> import core.sys.windows.windows : winMSG = MSG; // this leaves out other symbols
> Error: undefined identifier `HWND`
> Error: undefined identifier `LPCSTR`

import core.sys.windows.windows;
import mymodule;
alias MSG = mymodule.MSG;
alias winMSG = core.sys.windows.windows.MSG;
January 12, 2021
On Tuesday, 12 January 2021 at 20:19:20 UTC, ag0aep6g wrote:
> On 12.01.21 21:09, cc wrote:
>> import core.sys.windows.windows;
>> import mymodule; // contains a struct named MSG
>> Error: `core.sys.windows.winuser.MSG` ... conflicts with `mymodule.MSG`
>> 
>> vs
>> 
>> import core.sys.windows.windows : winMSG = MSG; // this leaves out other symbols
>> Error: undefined identifier `HWND`
>> Error: undefined identifier `LPCSTR`
>
> import core.sys.windows.windows;
> import mymodule;
> alias MSG = mymodule.MSG;
> alias winMSG = core.sys.windows.windows.MSG;

Ahh simple enough, thanks.