Inline Module / Namespace
Timothee Cour
thelastmammoth at gmail.com
Fri Mar 9 18:58:27 UTC 2018
I'm sure he meant:
```
--- foo.d
module foo;
module foo.bar{
void fun(){}
}
--- foo2.d
import foo.bar;
```
On Fri, Mar 9, 2018 at 10:51 AM, Manu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 9 March 2018 at 10:44, Jonathan via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> D kinda lacks a way of creating a module/namespace inside another file.
>>
>> D does have modules but they have to be in separate files. (Though separate
>> files may be better coding practice, why is it D's job to tell me how to
>> code.)
>>
>> I think a simple way to do this with existing syntax is to add functionality
>> for `module` to be used as a block.
>>
>>
>> module modulename {
>> void fun(){}
>> }
>> modulename.fun();
>>
>>
>> An inline module.
>
> If you tried to `import modulename;` from some other module... how
> would the compiler know where to find it?
More information about the Digitalmars-d
mailing list