Why modules is so strongly limited?

The D dude via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 16 13:48:16 PDT 2016


On Friday, 15 July 2016 at 20:49:05 UTC, imbaFireFenix wrote:
> On Thursday, 14 July 2016 at 09:36:17 UTC, Jonathan M Davis 
> wrote:
>> Java does basically the same thing (though they take it even 
>> farther, since they only allow one, public class per module), 
>> and IIRC, a number of other languages do as well (haskell does 
>> from what I recall, and python might; I don't remember
> Really! I don't know any people who migrate from namespace to 
> module/package system and don't hate this.

I am sorry, the simple module system in Python was on of the 
reason for its success. You do know that (if you are evil) you 
don't need to obey the module rules in D? As long as you import 
all required files, it won't complain. Of course this isn't 
recommended because the folder/file structure is also easier to 
understand for human beings.

>> If we didn't do it that way, then it would be a lot harder to 
>> figure out where all of the code for a given module was
> Sure, more flexibility - more complicated.
> But that not impossible...
> Or it can be enabled or disabled by compiler pararms...
>
>> while some folks may find it occasionally annoying, most of 
>> use have no problem whatosever with modules being files and 
>> packages being directories.
> Using modules like [namespaces + include] not prohibit using 1 
> file == [1 class | 1 module], there is expand possibilities for 
> beautifuly implementation.
>
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
>
> For me the best way as C#:
> All files in project file - including at compilation, but in 
> code - mount only at defined scope point (call for namespace 
> unit or using/import whole namespace)
>
> Don't need file or part of module? - Exclude from project.

o_O - that's the job of a compiler ;-)


More information about the Digitalmars-d mailing list