Skip to content

Packages not in uppercase should not be accepted#19824

Open
guillep wants to merge 2 commits into
pharo-project:Pharo14from
guillep:fix-package-naming
Open

Packages not in uppercase should not be accepted#19824
guillep wants to merge 2 commits into
pharo-project:Pharo14from
guillep:fix-package-naming

Conversation

@guillep

@guillep guillep commented Jun 26, 2026

Copy link
Copy Markdown
Member

Packages not in uppercase should not be accepted, because the system is not prepared for it:
By convention they should be in uppercase.

Right now, we support lowecase packages, but then they cannot be renamed (because package duplication is compared case insensitive), and many bugs are hit afterwards.

Prevent all issues by just preventing lowercase packages.

6 lines of test, 1 line of fix.

@jecisc jecisc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I just wonder if we should have an error or if we should just call #capitalized? In order to not break the loading of older code that might have lowercase package names?

@guillep

guillep commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

if we should just call #capitalized?

I have the feeling this is not a good decision.
Very magical...

In order to not break the loading of older code that might have lowercase package names?

I understand this point.
I'll happily fix it if we find this issue.
But I believe we will not find many of these.

@Ducasse

Ducasse commented Jun 26, 2026

Copy link
Copy Markdown
Member

This is strange because I thought we already fixed this.
I remember some bugs students got because of that so may be it was that the name was empty.

@Ducasse

Ducasse commented Jun 26, 2026

Copy link
Copy Markdown
Member

this test is failing and is related

testPackageCanNotContainSpaces
Unix64..KernelTests-ISO-Kernel.Kernel.CodeModel.Tests.PackageTest
[1](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-19824/1/)	0 ms	
Error Details
Package names should be uppercase

@guillep

guillep commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

this test is failing and is related

testPackageCanNotContainSpaces
Unix64..KernelTests-ISO-Kernel.Kernel.CodeModel.Tests.PackageTest
[1](https://ci.inria.fr/pharo-ci-jenkins2/job/Test%20pending%20pull%20request%20and%20branch%20Pipeline/job/PR-19824/1/)	0 ms	
Error Details
Package names should be uppercase

Nice! :D So there were tests creating broken packages!

@guillep

guillep commented Jun 26, 2026

Copy link
Copy Markdown
Member Author

I patched that test, but this is just bad:

imagen

We "transparently" let users create packages with spaces, and those spaces are magically trimmed.

This is related to the uppercase issue and comment above by @jecisc .

The issue with "magically" fixing the names is that this can be an issue that carries over many different places.
You can have method A that calls B, that calls C and so on, which eventually call ensurePackageNamed:.
If A is creating a wrong package name because of its own issue, and we "patch" it, A will remain buggy and the issue will remain undetected.

What if the spaces happen due to a wrong concatenation? how much time until we realize?

@Ducasse

Ducasse commented Jun 27, 2026

Copy link
Copy Markdown
Member

I see you prefer to raise an exception that the tools catch it and prompt the user.

BTW

MetacelloNotification: Done executing: baseline [BaselineOfLibGit] >> postload:package: (1 second 829 milliseconds)
SubclassResponsibility: RePackageRuleForTest class had the subclass responsibility to implement #ruleName
RePackageRuleForTest class(Object)>>subclassResponsibility

ifTrue: [ Package named: aPackage organizer: self ]
ifFalse: [ aPackage organizer: self ].

package name first isUppercase ifFalse: [ self error: 'Package names should be uppercase' ].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this test is not performed before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants