-
-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 16701 - Remove Restriction of "package.d" Source File Module Forc… #14260
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14260" |
b3439f6 to
c53b685
Compare
|
So this would fix that one issue, but the larger issue with package.d is that the compiler forces a filename at all. It should work like the rest of the language, where the filename can match the module name, or it can be told to it. This change would actually make it even more inconsistent with the rest of the language, by still requiring a filename, but, for once, not being case sensitive. (that said i do see the practical benefit of being case insensitive if you wanna force the name, but i still maintain that oyu shouldn't be forcing the name at all) |
934c720 to
5897e1d
Compare
I don't follow, what names are being forced to what exactly? A package module must be called "package.d" because it is special, I wouldn't want it to be called something else. |
|
There is zero justification for it to be special (and in fact, it goes directly counter to the stated justification for the feature in the first place, to maintain compatibility with old code!). THAT is the inconsistency with the rest of the language, and the root cause of most these bugs. |
What is the compiler supposed to do with |
|
The same thing it always does: check You can still put Of course, since we already have this brain-damaged design, it'd probably have to continue checking |
|
I personally think they should stay lowercase to be consisted with everything else, this change adds unnecessary inconsistencies |
What "everything else"? The only other special file I know of is |
with every other |
|
If that change goes in, we'll need to also update DCD to handle this |
This PR doesn't change those files, nor does it change the style convention. |
I don't see any case-sensitive filename checks in the linked code |
It doesn't change that but it introduce that possibility now |
it builds the path with |
The compiler isn't there to enforce a style guide. It would be especially weird if it enforces a casing style on "package.d" and nothing else. |
I don't see code that expects it to be lower case. |
When it is looking up modules normally, it assumes the file name matches the module name (unless you give it a list of files, in which case it ignores the name and just checks the module definition - which it doesn't allow for package.d lol). But when it uses the module name to guess the filename, that is case sensitive because module names are case sensitive in D. The underlying filesystem might return a case-insensitive answer though, which can cause trouble, so the style guide recommends always using all lowercase module names. But on linux, for example, the lookup is case sensitive in D and in the filesystem. |
What about other filesystems? It introduce unnecessary complexity, rules sometimes are beneficial, if some other people in their tools expect it to be lower case no matter what, they'd have to update their tools too, for what benefits? i don't see any, one improvement would be to get rid of the need of package.d as adam suggested |
This only affects Windows, which has a case insensitive file system. On Linux it's still case sensitive. I don't know what 'other' filesystems you're talking about.
I'm not a fan of the fact that Windows has a case-insensitive file system and its associated complexity, but DMD releases on Windows and adheres to its choice in most cases. The only exceptions I know of being this PR and #14261 . You could have a stance of enforcing casing even on Windows, but why only "package.d" and not everything else?
I agree, but that's for a later PR. This is a trivial fix. |
Actually the filename really should the module name. Anything else breaks too easily. @dkorpel : I don't see any test, and I don't see any change to the lookup code though, so I'm not sure it "fully" work ? EDIT: Right, I missed the part where this "only works on Windows", also consistent with extensions I suppose. |
5897e1d to
83baac0
Compare
|
@dkorpel can you add a test for this? |
…ed to All Lowercase
83baac0 to
5866d05
Compare
|
Done. auto-tester failure looks unrelated:
|
…ed to All Lowercase