question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package/module name recommendation is too heavy-handed

See original GitHub issue

The compiler currently produces four warnings in ceylon.ast.samples, about the package names ceylon.ast.samples.turingMachine, ….bodyReturnRewrite, ….completeCompilationUnit, and ….removeExtraInfoVisitor:

warning: all-lowercase ASCII package names are recommended

I also have some subpackages triggering this warning in other projects.

Since the compiler’s policy bans both camelCase and snake_case, I see no option left to “correct” those package names, other than making them unreadable (bodyreturnrewrite). As such, I think this restriction is much too heavy-handed. I also don’t understand the rationale for it – if, as @jvasileff says, it’s just taken from Java, where it’s apparently supposed to prevent conflicts with class/interface names¹, then I think it makes no sense at all in Ceylon, which also features (lowercase) toplevel functions and objects.

¹ John also argues that this policy doesn’t make sense in Java either, since the initial case should be enough to distinguish between a Class and a package.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zamfofexcommented, Apr 17, 2018

By the way, it’s interesting to note that Oracle’s Java tutorial says that, when converting a domain to a package name, hyphens should be converted to underscores.

Additionally, Google’s style guides for Java say that multiple words should simply be concatenated without underscores or different casing.

I myself would really hate to see camel case being used for packages/modules. Not only for the reasons @gavinking mentioned, but also because I’m really not used to seeing uppercase letters in package identifiers. Although I know it’s subjective, I just think that it feels off.

Additionally, I generally prefer underscores over camel‐case; if I could choose a convention for a language, I’d definitely choose underscores.

My list for naming package segments is, in order of preference is:

  • snake_case_for_the_win
  • nocasewhatsoever
  • camelCaseKindaSucks
0reactions
jvasileffcommented, Oct 16, 2017

I agree with @lucaswerkmeister that this won’t happen often. I also think that it is the responsibility of the organization owning the namespace to avoid naming conflicts and illegal nesting.

OTOH, Herd and the CLI tools should have errors (maybe they do already?) for attempting to store modules that conflict with existing modules in a way that is incompatible with the repository storage layout. Warnings aren’t sufficient.

Related, it looks like there is a repository conflict for the modules simple.v/simple-v.car and simple/v, with both having a filesystem entry modules/simple/v/simple-v.car.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Require module names to only be unique per package #2437
So I propose that, as far as the compiler is concerned, a "package" is just a name (which must be unique) and a...
Read more >
Use same name for module and package - python
So I use lower case for module (i.e. file) names and package (i.e. directories) names. Most of the time, I end up with...
Read more >
Package names - The Go Programming Language
On the other hand, if abbreviating a package name makes it ambiguous or unclear, don't do it. Don't steal good names from the...
Read more >
Traps for the Unwary in Python's Import System
The reason this is problematic is that every module in that directory is now potentially accessible under two different names: as a top...
Read more >
Using Modules and Packages in Go - Level Up Coding
A module, on the other hand, is a collection of Go packages, with dependencies ... A module is a directory of packages with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found