October 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330


Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |


--- Comment #10 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-10-28 01:59:14 EET ---
Since the ball's in the maintainers' court (per my requests for clarification above) and there has been no reply in 24 hours, reopening so this doesn't get lost.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #11 from Walter Bright <bugzilla@digitalmars.com> 2013-10-27 23:45:52 PDT ---
(In reply to comment #9)
> I don't see how a list of search paths is like a number of nested scopes.

It's always been that way, and C and C++ compilers operate the same way. To override, you put a path in front of the list of paths. The clear hierarchy is the ones earlier in the list override the ones later, i.e. the "first found" rule. Just like nested scopes.


> This is besides my argument, anyway, so I understand you're replying about the suggestion for module hijack protection?

This was in response to the idea that errors should be generated if a file appears in more than one path.


> If that's not the case, then it's even more unclear to me why this change was introduced, and why it is considered beneficial.

The change was made so that existing modules, like std.algorithm, could be split into multiple modules without breaking existing code.

See http://wiki.dlang.org/DIP37


> > 2. The import system is designed to map onto the file system. Using file/directory names that match module/package names is how it is supposed to work, if there are matching names that have nothing to do with D will cause problems.
> 
> This does not address my arguments in comment #2.
> 
> Also, without context, your quote can be used to defend a hypothetical change in DMD to reject "modulename.txt" files, if they exist in the search path and "modulename" is imported somewhere, which is absurd. Which is the main point of my argument: D compilers should not treat filesystem directories that match imported D modules as if they are made for use for D. ".d" files are for D compilers, directories are for everyone.

Directory names have always been regarded as having a 1:1 correspondence with package names in D. This is not new. std.algorithm corresponds to std/algorithm.d


> As far as I know, no other implementation of a package system in any other language behaves as DMD behaves now.

As I recall, this was debated at length and was implemented months ago.


> I hope this isn't an attempt to sweep a regression under the rug to get 2.064
> out quicker:
> - I have stumbled upon this problem twice, in two different situations.
> - This change affected two other users (issue 11241 and issue 11243).

I am sorry it breaks some existing setups, but the behavior is designed, and is not a bug. There were several proposals, and this one broke the least and before this everyone has liked it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #12 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-10-28 15:33:14 EET ---
(In reply to comment #11)
> The change was made so that existing modules, like std.algorithm, could be split into multiple modules without breaking existing code.

This does not explain or justify the problem this bug report is describing.

> See http://wiki.dlang.org/DIP37

The DIP specification says NOTHING about treating the first directory in its search path as the match for a package. As far as I can see, the behavior in question is an artifact of a poor implementation. In fact, the DIP says the following:

> Also, having a package and module with the same name will result in an ambiguity error when you try and import them (e.g. foo/bar/package.d and foo/bar.d).

So the current behavior actually deviates from the design!

> Directory names have always been regarded as having a 1:1 correspondence with package names in D. This is not new. std.algorithm corresponds to std/algorithm.d

This does not explain or justify the problem this bug report is describing.

> As I recall, this was debated at length and was implemented months ago.

I do not recall any discussion that reached a consensus that the first directory in D's search path should be treated as the match for an import of the same name.

> I am sorry it breaks some existing setups, but the behavior is designed, and is not a bug. There were several proposals, and this one broke the least and before this everyone has liked it.

I am sorry, but judging by your arguments quoted above, I must conclude that you either don't understand the problem, or are unable to justify the current behavior. I must ask you to read my arguments carefully and respond to my clarification requests directly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #13 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-10-28 15:50:06 EET ---
Assuming good faith and that the problem is miscommunication, here's a clarification of the problem this bug report is describing:

1) I am not against anything written on http://wiki.dlang.org/DIP37.

2) I only have a problem with treating directories (disregarding their
contents) as matches on the search path.

3) My suggestion is to also check for the "package.d" file inside the directory when considering a directory as a search path match. If it does not exist, then continue search as if that directory did not exist.

Would this be acceptable? If not, why not?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #14 from Walter Bright <bugzilla@digitalmars.com> 2013-10-28 23:13:35 PDT ---
(In reply to comment #13)
> 3) My suggestion is to also check for the "package.d" file inside the directory when considering a directory as a search path match. If it does not exist, then continue search as if that directory did not exist.

Makes sense.

https://github.com/D-Programming-Language/dmd/pull/2696

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 29, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #15 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-10-29 08:16:04 EET ---
Phew :) I'm really glad this was just a miscommunication. Thank you!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 30, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #16 from github-bugzilla@puremagic.com 2013-10-30 07:42:13 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/671161e4d5340afcb618c6cf3ded2c6d991a8c02
fix Issue 11330 - Directory named as imported module should not stop module
search

https://github.com/D-Programming-Language/dmd/commit/e5a0c64af40264744f0eed497b7ed517b1df7c4e Merge pull request #2696 from WalterBright/fix11330

fix Issue 11330 - Directory named as imported module should not stop module search

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 30, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330



--- Comment #17 from github-bugzilla@puremagic.com 2013-10-30 10:14:33 PDT ---
Commit pushed to 2.064 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/eb1b00441491f1be554892963358462506c78403 Merge pull request #2696 from WalterBright/fix11330

fix Issue 11330 - Directory named as imported module should not stop module search

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 30, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11330


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »