www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - " include imported modules in the compilation " should exclude di file

reply Calvin P <changlon gmail.com> writes:
The current compiler "-i=module_name" option will  include 
imported modules as source code.

When the module define from di file extension, I think compiler 
should avoid treat it as source file.

What do you think?
Mar 09 2020
next sibling parent Calvin P <changlon gmail.com> writes:
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote:
 The current compiler "-i=module_name" option will  include 
 imported modules as source code.

 When the module define from di file extension, I think compiler 
 should avoid treat it as source file.

 What do you think?
The use case: If I want to define a collection function only use for ctfe, I can put them into di file to avoid binary bloat. It also can be used create helper module for BetterC library, so you can use "new Struct" in the di and import it from betterC module. without use "-I=-lib_helper" to exclude every helper module in the library.
Mar 09 2020
prev sibling parent Mathias Lang <pro.mathias.lang gmail.com> writes:
On Monday, 9 March 2020 at 13:55:08 UTC, Calvin P wrote:
 The current compiler "-i=module_name" option will  include 
 imported modules as source code.

 When the module define from di file extension, I think compiler 
 should avoid treat it as source file.

 What do you think?
Sounds sensible. Can you raise a bug report ?
Mar 18 2020