www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - module renaming by declaration

reply "Christof Schardt" <Christof Schardt.info> writes:
The module declaration allows to define a module name different from the 
filename.
(TDPL sec. 11.1.8)
I tried a simple example:

File test.d:
---------
  import bbb;
---------

File aaa.d (same directory):
---------
   module bbb;
---------

Running
  rdmd test.d
does give an error: "module bbb is in file bbb.d which cannot be read"

What am I doing wrong?
Mar 19 2016
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Saturday, 19 March 2016 at 16:02:33 UTC, Christof Schardt 
wrote:
 What am I doing wrong?
Using rdmd. It assumes the filename will match the module name to locate the file, though the language itself doesn't require this. What you want to do to make this work is use ordinary dmd and pass both files to it at the same time: dmd aaa.d test.d and it will work then.
Mar 19 2016