www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.internals - Removing ddmd. prefix from dmd module names

reply Walter Bright <newshound2 digitalmars.com> writes:
The dmd build has a problem - all the .d files have to be specified on the same 
command line. The trouble is the prefix ddmd. on all the imports, yet there is 
no ddmd directory. D is designed to have the path/file structure match the 
package/module structure.

   https://github.com/dlang/dmd/pull/6249

illustrates the change. Another option is to move the files into a subdirectory 
named 'ddmd'.

It's worth some wider discussion.
Nov 09 2016
next sibling parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On Thursday, 10 November 2016 at 07:44:08 UTC, Walter Bright 
wrote:
 The dmd build has a problem - all the .d files have to be 
 specified on the same command line. The trouble is the prefix 
 ddmd. on all the imports, yet there is no ddmd directory. D is 
 designed to have the path/file structure match the 
 package/module structure.

   https://github.com/dlang/dmd/pull/6249

 illustrates the change. Another option is to move the files 
 into a subdirectory named 'ddmd'.

 It's worth some wider discussion.
Another option is to get around to making the frontend actually fully separate in the directory structure to the backend. E.g. src/dlang/frontend/ src/dlang/backend/ src/dlang/mars.d import dlang.frontend.apply; It would be the first stage of actually making the frontend actually palatable to us end developers.
Nov 09 2016
parent reply Dicebot <public dicebot.lv> writes:
 protected-headers="v1"
From: Dicebot <public dicebot.lv>
Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,i,n,t,e,r,n,a,l,s
Subject: Re: Removing ddmd. prefix from dmd module names
References: <o018g5$1b1u$1 digitalmars.com>
 <zmeinjjnynwsrezekzaf forum.dlang.org>
In-Reply-To: <zmeinjjnynwsrezekzaf forum.dlang.org>

--LTW1kUEkrrQ65saLGCL068gdcOUwaotIf
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 11/10/2016 09:47 AM, Rikki Cattermole wrote:
 Another option is to get around to making the frontend actually fully
 separate in the directory structure to the backend.
=20
 E.g.
=20
 src/dlang/frontend/
 src/dlang/backend/
 src/dlang/mars.d
=20
 import dlang.frontend.apply;
=20
 It would be the first stage of actually making the frontend actually
 palatable to us end developers.
I am in favor of this approach, shorter `dmd.fe` and `dmd.be` would be just fine. It is weird to have package names based on implementations details and not semantical purpose. --LTW1kUEkrrQ65saLGCL068gdcOUwaotIf--
Nov 10 2016
parent Mathias Lang <pro.mathias.lang gmail.com> writes:
On Thursday, 10 November 2016 at 13:19:52 UTC, Dicebot wrote:
 On 11/10/2016 09:47 AM, Rikki Cattermole wrote:
 Another option is to get around to making the frontend 
 actually fully separate in the directory structure to the 
 backend.
 
 E.g.
 
 src/dlang/frontend/
 src/dlang/backend/
 src/dlang/mars.d
 
 import dlang.frontend.apply;
 
 It would be the first stage of actually making the frontend 
 actually palatable to us end developers.
I am in favor of this approach, shorter `dmd.fe` and `dmd.be` would be just fine. It is weird to have package names based on implementations details and not semantical purpose.
I would favor this even more, but AFAIR Walter was against using packages in DMD: https://github.com/dlang/dmd/pull/5730#issuecomment-224069664 It's been 10 days without comment. What critera would lead to a resolution (do we need more comments or more time ?)
Nov 20 2016
prev sibling next sibling parent ketmar <ketmar ketmar.no-ip.org> writes:
On Thursday, 10 November 2016 at 07:44:08 UTC, Walter Bright 
wrote:
 The dmd build has a problem - all the .d files have to be 
 specified on the same command line. The trouble is the prefix 
 ddmd. on all the imports, yet there is no ddmd directory. D is 
 designed to have the path/file structure match the 
 package/module structure.

   https://github.com/dlang/dmd/pull/6249

 illustrates the change. Another option is to move the files 
 into a subdirectory named 'ddmd'.

 It's worth some wider discussion.
i think that moving to ddmd/ is better. it is good to have compiler in it's own namespace (ddmd.). even in the current state some compiler parts can be reused in other projects, and polluting "root" namespace or forcing people to manually patch the code each time doesn't look as a good solution for me.
Nov 09 2016
prev sibling next sibling parent Mathias Lang <mathias.lang sociomantic.com> writes:
On Thursday, 10 November 2016 at 07:44:08 UTC, Walter Bright 
wrote:
 The dmd build has a problem - all the .d files have to be 
 specified on the same command line. The trouble is the prefix 
 ddmd. on all the imports, yet there is no ddmd directory. D is 
 designed to have the path/file structure match the 
 package/module structure.

   https://github.com/dlang/dmd/pull/6249

 illustrates the change. Another option is to move the files 
 into a subdirectory named 'ddmd'.

 It's worth some wider discussion.
Thanks for bringing the topic up. Linking for the issue where the discussion started, for reference: https://issues.dlang.org/show_bug.cgi?id=16071 I would much rather go with the second solution, that is, move the files from `src/` to `src/ddmd/`. That will prevent some silly conflicts you can see with un-packaged modules. One bug we witnessed during the D2 porting is for example that any module which has the same name as one of it's symbol (in our case, `Version.Version`) is unusable if the module is imported unqualified, because the module itself is a symbol.
Nov 10 2016
prev sibling next sibling parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Thursday, 10 November 2016 at 07:44:08 UTC, Walter Bright 
wrote:
 It's worth some wider discussion.
Some previous discussion here: https://github.com/dlang/dmd/pull/6217
Nov 10 2016
prev sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 11/9/2016 11:44 PM, Walter Bright wrote:
 The dmd build has a problem - all the .d files have to be specified on the same
 command line. The trouble is the prefix ddmd. on all the imports, yet there is
 no ddmd directory. D is designed to have the path/file structure match the
 package/module structure.

   https://github.com/dlang/dmd/pull/6249

 illustrates the change. Another option is to move the files into a subdirectory
 named 'ddmd'.

 It's worth some wider discussion.
I came up with another solution that does not require any source code changes: https://issues.dlang.org/show_bug.cgi?id=16798 https://github.com/dlang/dmd/pull/6286
Nov 27 2016
next sibling parent reply Dicebot <public dicebot.lv> writes:
 protected-headers="v1"
From: Dicebot <public dicebot.lv>
Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,i,n,t,e,r,n,a,l,s
Subject: Re: Removing ddmd. prefix from dmd module names
References: <o018g5$1b1u$1 digitalmars.com> <o1fpf0$23ip$1 digitalmars.com>
In-Reply-To: <o1fpf0$23ip$1 digitalmars.com>

--RwEKbfheSwl4pd3XsWkJk3laxWoFlhwes
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 11/28/2016 01:15 AM, Walter Bright wrote:
 On 11/9/2016 11:44 PM, Walter Bright wrote:
 The dmd build has a problem - all the .d files have to be specified on=
 the same
 command line. The trouble is the prefix ddmd. on all the imports, yet
 there is
 no ddmd directory. D is designed to have the path/file structure match=
 the
 package/module structure.

   https://github.com/dlang/dmd/pull/6249

 illustrates the change. Another option is to move the files into a
 subdirectory
 named 'ddmd'.

 It's worth some wider discussion.
=20 I came up with another solution that does not require any source code changes: =20 https://issues.dlang.org/show_bug.cgi?id=3D16798 https://github.com/dlang/dmd/pull/6286
In this specific case "and refactoring the package/module names is undesirable for various reasons" is not truly relevant - refactoring of dmd package stucture IS much desirable on its own even if there are no other reasons to do so. Interesting idea though. --RwEKbfheSwl4pd3XsWkJk3laxWoFlhwes--
Nov 27 2016
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 11/27/2016 6:11 PM, Dicebot wrote:
 On 11/28/2016 01:15 AM, Walter Bright wrote:
 https://issues.dlang.org/show_bug.cgi?id=16798
 https://github.com/dlang/dmd/pull/6286
In this specific case "and refactoring the package/module names is undesirable for various reasons" is not truly relevant - refactoring of dmd package stucture IS much desirable on its own even if there are no other reasons to do so.
The thing is, I also want to convert the dmd back end to D, and continue using it as a back end for DMC++. Some people want to use various parts of dmd for libraries. Trying to push everything into the same file structure is not impossible, but rather disruptive. Having this new switch means that users can independently adjust the file structure as they see fit on their own time schedule.
Nov 27 2016
next sibling parent reply Sebastien Alaiwan <ace17 free.fr> writes:
On Monday, 28 November 2016 at 04:15:28 UTC, Walter Bright wrote:
 Having this new switch means that users can independently 
 adjust the file structure as they see fit on their own time 
 schedule.
I had asked for this feature in a post on this very forum, but at this time I only faced incomprehension. http://forum.dlang.org/thread/kelnnikayrncidcwaczy forum.dlang.org
 After many projects spent thinking of this issue, I came to the 
 conclusion that being able to specify, on the
 command line, the module name of the module currently being
 compiled, thus allowing to override it to be inferred to
 the basename of the file, would solve this problem.
The current module system is too rigid, and requiring the directory structure to match the module hierarchy is too much of a constraint (and yes, I'm talking about separate compilation here). Finally! :-)
Nov 27 2016
parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/27/2016 10:45 PM, Sebastien Alaiwan wrote:
 On Monday, 28 November 2016 at 04:15:28 UTC, Walter Bright wrote:
 Having this new switch means that users can independently adjust the file
 structure as they see fit on their own time schedule.
I had asked for this feature in a post on this very forum, but at this time I only faced incomprehension. http://forum.dlang.org/thread/kelnnikayrncidcwaczy forum.dlang.org
I knew it had come up before, but didn't remember where or when. Thanks for the link.
 The current module system is too rigid, and requiring the directory structure
to
 match the module hierarchy is too much of a constraint (and yes, I'm talking
 about separate compilation here).

 Finally! :-)
Yes, looks like you prevailed!
Nov 27 2016
prev sibling parent reply Dicebot <public dicebot.lv> writes:
 protected-headers="v1"
From: Dicebot <public dicebot.lv>
Newsgroups: d,i,g,i,t,a,l,m,a,r,s,.,D,.,i,n,t,e,r,n,a,l,s
Subject: Re: Removing ddmd. prefix from dmd module names
References: <o018g5$1b1u$1 digitalmars.com> <o1fpf0$23ip$1 digitalmars.com>
 <o1g3pd$2oc7$1 digitalmars.com> <o1gb0v$42e$1 digitalmars.com>
In-Reply-To: <o1gb0v$42e$1 digitalmars.com>

--vQrwI9h7nbJFIijV3wHiHhROCFIIlXkqJ
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 11/28/2016 06:15 AM, Walter Bright wrote:
 On 11/27/2016 6:11 PM, Dicebot wrote:
 On 11/28/2016 01:15 AM, Walter Bright wrote:
 https://issues.dlang.org/show_bug.cgi?id=3D16798
 https://github.com/dlang/dmd/pull/6286
In this specific case "and refactoring the package/module names is undesirable for various reasons" is not truly relevant - refactoring o=
f
 dmd package stucture IS much desirable on its own even if there are no=
 other reasons to do so.
=20 The thing is, I also want to convert the dmd back end to D, and continu=
e
 using it as a back end for DMC++. Some people want to use various parts=
 of dmd for libraries.
Still it would be nice to get your preference/approval for some of dmd package models proposed here - it will come up again anyway.
 Having this new switch means that users can independently adjust the
 file structure as they see fit on their own time schedule.
No objections here. --vQrwI9h7nbJFIijV3wHiHhROCFIIlXkqJ--
Nov 28 2016
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 11/28/2016 1:43 AM, Dicebot wrote:
 Still it would be nice to get your preference/approval for some of dmd
 package models proposed here - it will come up again anyway.
I know. But I am unsure what the right arrangement is. At least this switch converts the problem from a crisis to an annoyance.
Nov 28 2016
parent reply Mathias Lang <mathias.lang sociomantic.com> writes:
On Monday, 28 November 2016 at 12:13:44 UTC, Walter Bright wrote:
 On 11/28/2016 1:43 AM, Dicebot wrote:
 Still it would be nice to get your preference/approval for 
 some of dmd
 package models proposed here - it will come up again anyway.
I know. But I am unsure what the right arrangement is. At least this switch converts the problem from a crisis to an annoyance.
If you want to keep using the DMD backend for DMC++, I guess you plan to have: - The header files available somewhere, in sync with the D files - The D code compiled as a static library Or am I missing something ? If it's the case, then it won't make much of a difference what D hierarchy the D modules have, will it ?
Nov 28 2016
parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/28/2016 6:01 AM, Mathias Lang wrote:
 If you want to keep using the DMD backend for DMC++, I guess you plan to have:
 - The header files available somewhere, in sync with the D files
The backend header files will eventually go away, until then, they stay in sync.
 - The D code compiled as a static library
No.
 Or am I missing something ?
 If it's the case, then it won't make much of a difference what D hierarchy the
D
 modules have, will it ?
The point of the new switch is then it won't matter what the D hierarchy is and decisions about DMC++ needn't affect DMD.
Nov 28 2016
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On Sunday, 27 November 2016 at 23:15:45 UTC, Walter Bright wrote:

 I came up with another solution that does not require any 
 source code changes:

 https://issues.dlang.org/show_bug.cgi?id=16798
 https://github.com/dlang/dmd/pull/6286
I would prefer moving all files to a "ddmd" directory. This would make it compatible with DCD. -- /Jacob Carlborg
Nov 28 2016
parent Walter Bright <newshound2 digitalmars.com> writes:
On 11/28/2016 4:43 AM, Jacob Carlborg wrote:
 On Sunday, 27 November 2016 at 23:15:45 UTC, Walter Bright wrote:

 I came up with another solution that does not require any source code changes:

 https://issues.dlang.org/show_bug.cgi?id=16798
 https://github.com/dlang/dmd/pull/6286
I would prefer moving all files to a "ddmd" directory. This would make it compatible with DCD.
Nothing about this proposal positively or negatively affects such movement. And that's the point!
Nov 28 2016