Feature request: allow using the dash character in package names
David Holmes
david.holmes at oracle.com
Mon Dec 5 06:54:41 UTC 2016
Hi Behrang,
On 5/12/2016 4:00 PM, Behrang Saeedzadeh wrote:
> Hi,
>
> Unless this is going to be very challenging, I think it would be nice to
> allow using the dash character in package names.
There are global rules for the forms of all Java Identifiers based on
Unicode character blocks, so we can't really special-case package names.
The allowed characters include the "combining punctuators" which I
believe are more formally defined as the "combining diacritical marks"
http://www.unicode.org/charts/PDF/U0300.pdf
(which includes the ASCII underscore). There are quite a lot of these
that might look elegant if you could type them in directly, but not so
elegant as unicode escapes:
package my\u0323weird.package\u005fname.in\u0332pieces;
:) (the above does compile)
"Dashes" have their own little grouping in Unicode and are considered
in-word connectors - as in in-word :)
But more significantly '-' is defined as an operator in Java and
allowing it to also be part of an identifier would be quite a
complication to the grammar and parsing rules.
So yes it would be very challenging to change the rules here.
> At the moment there's no elegant way to create packages with compound
> names. Underscore and camel case look don't feel suitable for package names.
>
> So rather than:
>
> * error_handling, or
> * errorHandling
>
> It would be nice if we could use:
>
> * error-handling
How about error.handling? Elegance is a very subjective thing.
Regards,
David
> Best regards,
> Behrang Saeedzadeh
>
More information about the discuss
mailing list