Feature request: allow using the dash character in package names

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Feature request: allow using the dash character in package names

Behrang Saeedzadeh
Hi,

Unless this is going to be very challenging, I think it would be nice to
allow using the dash character in package names.

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

Best regards,
Behrang Saeedzadeh
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: allow using the dash character in package names

David Holmes
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
>
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: allow using the dash character in package names

Peter Lawrey-3
The problem with

error-handling

is that it currently parses the same as

error - handling

or

(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

error.handling

This is a nested package but is quite readable.

Regards,
   Peter.


On 5 December 2016 at 06:54, David Holmes <[hidden email]> wrote:

> 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
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Feature request: allow using the dash character in package names

Behrang Saeedzadeh
Thanks for the replies! I think \u0335 would be a good candidate if it was
a common character. :)

I guess error.handling is good enough.

P.S: In REBOL, IIRC, it was possible to use `-` in identifiers. :)

Best regards,
Behrang Saeedzadeh

On 5 December 2016 at 20:18, Peter Lawrey <[hidden email]> wrote:

> The problem with
>
> error-handling
>
> is that it currently parses the same as
>
> error - handling
>
> or
>
> (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
>
> error.handling
>
> This is a nested package but is quite readable.
>
> Regards,
>    Peter.
>
>
> On 5 December 2016 at 06:54, David Holmes <[hidden email]> wrote:
>
>> 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
>>>
>>>
>