module name inference
Timothee Cour
thelastmammoth at gmail.com
Mon Jul 15 11:01:26 PDT 2013
On Mon, Jul 15, 2013 at 9:55 AM, Peter Alexander <
peter.alexander.au at gmail.com> wrote:
> On Monday, 15 July 2013 at 15:45:47 UTC, Timothee Cour wrote:
>
>> ---- src/foo/bar.d:
>> // infers 'module foo.bar;' instead of 'module bar;'
>> void barfun(){}
>> ----
>>
>> ---- src/main.d:
>> import foo.bar;
>> void main(){}
>> ----
>>
>> dmd -Isrc src/main.d
>>
>
> And what if I compile it like this?
>
> dmd -c src/foo/bar.d
> dmd -c -Isrc src/main.d
> // link later
>
> I don't think this can work in general.
>
Yes I thought about that case. It would still work by passing the same -I
flags:
dmd -c -Isrc src/foo/bar.d
dmd -c -Isrc src/main.d
// link later
When a file would be fully specified on the command line as above, the -I
flag would specify the offset from which to compute the relative path. I
think it's a simple rule that makes code more DRY and easy to refactor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130715/af19a134/attachment.html>
More information about the Digitalmars-d
mailing list