Is package.d a good idea?

Basile B. b2.temp at gmx.com
Sun Jul 1 18:07:50 UTC 2018


On Sunday, 1 July 2018 at 14:23:36 UTC, Yuxuan Shui wrote:
> On Sunday, 1 July 2018 at 11:55:17 UTC, Jonathan M Davis wrote:
>> On Sunday, July 01, 2018 11:36:51 Yuxuan Shui via 
>> Digitalmars-d wrote:
>>> [...]
>>
>> The entire reason that package.d was added as a feature was so 
>> that modules could be split into packages without breaking 
>> code, and it's still valuable for that.
>>
>> [...]
>
> I was suggesting we do what Rust did. i.e. 'import foo', 
> imports foo.d, which can in turn do 'import foo.bar', which 
> will import foo/bar.d.

You mean that if no package.d is present, the import that *would* 
match to the missing package is then equivalent to an automatic 
public import for each module prefixed ?

- case 1 : `import foo;` use package.d


foo/package.d
    /bar.d
    /baz.d

- case 2 : `import foo;` make all stuff (bar/baz) public imports 
automatically if no package.d

foo/bar.d
    /baz.d

If this is what you mean then this could indeed be added, as 
sugar, in addition to the existing system of package. By "could" 
i mean from a technical P.o.V, because of course this kind of 
stuff are decided elsewhere.


More information about the Digitalmars-d mailing list