digitalmars.D.learn - Dividing D Module between multiple files
- Muahmmad Adel (14/14) Feb 17 2015 I have searched online and I found no way for dividing D Module
- Daniel =?UTF-8?B?S296w6Fr?= via Digitalmars-d-learn (6/25) Feb 17 2015 On Wed, 18 Feb 2015 07:23:24 +0000
- rumbu (10/19) Feb 18 2015 The problem with this approach is that you will end with ugly
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (9/13) Feb 18 2015 As always, documentation can be better. :) There is the relatively new
I have searched online and I found no way for dividing D Module between multiple files. While other languages move to making classes distributed on opposite direction, and makes a bigger code unit in one file. Biding every module to single file means large files, with high probability of merge conflicts (as more developers are working on the same file) makes separating developer's code from IDE generated code more difficult. I need to understand the rationale behind binding the module to the file. Although Alexandrescu explained rationale behind different language design decisions in his book, he didn't explain this one. Thanks
Feb 17 2015
On Wed, 18 Feb 2015 07:23:24 +0000 Muahmmad Adel via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:I have searched online and I found no way for dividing D Module between multiple files. While other languages move to making classes distributed on opposite direction, and makes a bigger code unit in one file. Biding every module to single file means large files, with high probability of merge conflicts (as more developers are working on the same file) makes separating developer's code from IDE generated code more difficult. I need to understand the rationale behind binding the module to the file. Although Alexandrescu explained rationale behind different language design decisions in his book, he didn't explain this one. ThanksYou are not force to do so I do not see any trouble here. For eg. I have lots of file where I have only one class (similar to java concept).
Feb 17 2015
On Wednesday, 18 February 2015 at 07:34:13 UTC, Daniel Kozák wrote:On Wed, 18 Feb 2015 07:23:24 +0000 Muahmmad Adel via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> wrote:I have searched online and I found no way for dividing D Module between multiple files.You are not force to do so I do not see any trouble here. For eg. I have lots of file where I have only one class (similar to java concept).The problem with this approach is that you will end with ugly class names like mypackage.myclass.MyClass. and I ended with a huge package.d file just to keep pretty names like mypackage.MyClass. Another way to trick the compiler is to mixin import all modules in the package.d file but you'll loose features like code completion in your editor.
Feb 18 2015
On 02/17/2015 11:23 PM, Muahmmad Adel wrote:I have searched online and I found no way for dividing D Module between multiple files.As always, documentation can be better. :) There is the relatively new "package module": http://dlang.org/module.html#package-module http://ddili.org/ders/d.en/modules.html#ix_modules.package%20importhigh probability of merge conflicts (as more developers are working on the same file)A merge conflict at the file level yes, but if the developers are touching different parts of that file, then most merge tools wouldn't see that as a merge conflict. Ali
Feb 18 2015