Thread overview |
---|
January 12, 2021 Renamed but non-selective import? | ||||
---|---|---|---|---|
| ||||
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 Re: Renamed but non-selective import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to cc | 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 Re: Renamed but non-selective import? | ||||
---|---|---|---|---|
| ||||
Posted in reply to ag0aep6g | 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.
|
Copyright © 1999-2021 by the D Language Foundation