Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #39434

Character.isIdentifierIgnorable

From Jeff Higgins <invalid@invalid.org>
Newsgroups comp.lang.java.programmer
Subject Character.isIdentifierIgnorable
Date 2020-04-24 18:46 -0400
Organization A noiseless patient Spider
Message-ID <r7vqa2$ekn$1@dont-email.me> (permalink)

Show all headers | View raw


Recently I wanted to implement a system of names and a hierarchic
namespace. My first thought was to use Java names, simply ignoring
the Java language semantics. So, investigating what exactly is a Java
name I came across this paragraph in the JLS Chapter 3.8.

quote
Two identifiers are the same only if, after ignoring characters that are
ignorable, the identifiers have the same Unicode character for each 
letter or digit. An ignorable character is a character for which the 
method Character.isIdentifierIgnorable(int) returns true. Identifiers 
that have the same external appearance may yet be different.
unquote

So, in my system of names I don't have to follow exactly follow the JLS,
but thinking more about this paragraph I began to wonder and hope that
someone here could help me understand.

What is the motivation for including these ignorable characters in
Java identifiers?

Where exactly in the Java environment (tools, language, standard 
libraries, etc.) are two identifiers checked according to the above 
specification?

For instance I can do:

class IdentifierTest {
   class _\u0001 {}
   class _\u0001\u0001 {}
}

and javac doesn't complain, which is understandable because those are
two different names - but then again these are the same identifier if
the ignorable \u001 are ignored - and even more curious - in Java later 
than 8 the underscore is a keyword so if the \u0001's are ignored then
I have two classes with the simple name of _?

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 18:46 -0400
  Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-24 18:54 -0400
    Re: Character.isIdentifierIgnorable Martin Gregorie <martin@mydomain.invalid> - 2020-04-24 23:07 +0000
    Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 20:12 -0400
      Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-24 20:29 -0400
        Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 20:37 -0400
          Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-24 22:24 -0400
            Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 23:36 -0400
              Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-25 12:57 -0400
                Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-25 13:01 -0400
                Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-25 13:39 -0400
                Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-25 13:51 -0400
                Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-25 14:36 -0400
            Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 23:41 -0400
    Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 20:25 -0400
      Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-24 20:32 -0400
        Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-24 20:42 -0400
          Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-25 09:53 -0400
            Re: Character.isIdentifierIgnorable Arne Vajhøj <arne@vajhoej.dk> - 2020-04-25 12:55 -0400
              Re: Character.isIdentifierIgnorable Jeff Higgins <invalid@invalid.org> - 2020-04-25 13:43 -0400

csiph-web