digitalmars.D.learn - imports in a Separate File?
- Ron Tarrant (13/13) Dec 11 2018 I ran across a code example
- Steven Schveighoffer (8/28) Dec 11 2018 Use public imports in your header file. This will pretend that the
- Ron Tarrant (3/10) Dec 11 2018 Thanks, Steve. Works like a charm... but you knew that.
I ran across a code example (https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/Test indow/TestWindow.d) in which the first ~120 lines are mostly import statements. And it got me wondering... I tried to off-load a bunch of imports into a pseudo-header file — importedStuff.d — and then in the actual code file I just did: import importedStuff; but found myself swimming in undefined identifier errors. Is there a way to do this so I wouldn't have to scroll 120 lines into a file before finding code? Or does this mean I still haven't caught onto what I was told the last time I was on this forum? (And here's a grammar question, just for the heck of it: Why isn't forum spelled with an 'n,' like column?)
Dec 11 2018
On 12/11/18 10:27 AM, Ron Tarrant wrote:I ran across a code example (https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/Test indow/TestWindow.d) in which the first ~120 lines are mostly import statements. And it got me wondering... I tried to off-load a bunch of imports into a pseudo-header file — importedStuff.d — and then in the actual code file I just did: import importedStuff; but found myself swimming in undefined identifier errors. Is there a way to do this so I wouldn't have to scroll 120 lines into a file before finding code? Or does this mean I still haven't caught onto what I was told the last time I was on this forum? (And here's a grammar question, just for the heck of it: Why isn't forum spelled with an 'n,' like column?)Use public imports in your header file. This will pretend that the symbols imported reside in the module itself. i.e. inside importedStuff.d: public { // 120 import statements } -Steve
Dec 11 2018
On Tuesday, 11 December 2018 at 15:39:18 UTC, Steven Schveighoffer wrote:Use public imports in your header file. This will pretend that the symbols imported reside in the module itself. i.e. inside importedStuff.d: public { // 120 import statements } -SteveThanks, Steve. Works like a charm... but you knew that.
Dec 11 2018