Feature request: allow using the dash character in package names
peter.lawrey at gmail.com
Mon Dec 5 09:18:45 UTC 2016
The problem with
is that it currently parses the same as
error - handling
(error) - (handling)
You could try a different currency or continuation character however you
would need to check it is supported by the operating system. An approach I
have used which works is
This is a nested package but is quite readable.
On 5 December 2016 at 06:54, David Holmes <david.holmes at oracle.com> wrote:
> Hi Behrang,
> On 5/12/2016 4:00 PM, Behrang Saeedzadeh wrote:
>> 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"
> (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
>> 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.
> Best regards,
>> Behrang Saeedzadeh
More information about the discuss