Skip to content

spec: combining mark & non spacing mark as invalid go identifiers make it pointless to use Devanagari identifiers #5167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gopherbot opened this issue Mar 31, 2013 · 8 comments
Labels
FrozenDueToAge LanguageChange Suggested changes to the Go language Thinking v2 An incompatible library change
Milestone

Comments

@gopherbot
Copy link
Contributor

by [email protected]:

1. What is a short input program that triggers the error?
Using a typical word in Devanagari used as identifier will cause compiler error. (e.g.
नमस्ते := "Hello")
Sample program at: http://play.golang.org/p/uxBtQZUjxU

Aside: Indentation is removed by play.golang.org editor after adding Devanagari
character anywhere on a line.

2. What is the full compiler output?
prog.go:6: invalid identifier character 0x94d
prog.go:6: invalid identifier character 0x947
prog.go:7: invalid identifier character 0x94d
prog.go:7: invalid identifier character 0x947

3. What version of the compiler are you using?  (Run it with the -V flag.)
1.03

4. Please provide any additional information below.
Go specification only recognize Lu, Ll, Lt, Lm, Lo and '_' as valid letter for
identifiers. However, unlike other languages Devanagari script uses signs (e.g. U+0947)
to represent vowels. So using Devanagari for identifiers is pointless in go (imagine
writing English without using 'aeiou').

My suggestion is to amend Go specification by allowing combining-mark &
non-spacing-mark characters in identifiers.

This will be similar to Java identifier rules givent at
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Character.html#isJavaIdentifierPart(char)
A character may be part of a Java identifier if any of the following are true:
  * it is a letter
  * it is a currency symbol (such as '$')
  * it is a connecting punctuation character (such as '_')
  * it is a digit
  * it is a numeric letter (such as a Roman numeral character)
  * it is a combining mark
  * it is a non-spacing mark
  * isIdentifierIgnorable returns true for the character

I am willing to work for a patch if this proposal is accepted.
@peterGo
Copy link
Contributor

peterGo commented Mar 31, 2013

Comment 1:

The Unicode Standard
Chapter 9
South Asian Scripts-I
Devanagari
http://www.unicode.org/versions/Unicode6.1.0/ch09.pdf
The Unicode Standard
Devanagari
http://www.unicode.org/charts/PDF/U0900.pdf

@remyoudompheng
Copy link
Contributor

Comment 2:

Labels changed: added languagechange.

@griesemer
Copy link
Contributor

Comment 3:

Owner changed to @robpike.

Status changed to Thinking.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 4:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added repo-main.

@gopherbot gopherbot added Thinking priority-triage LanguageChange Suggested changes to the Go language labels Dec 4, 2013
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@robpike robpike added the v2 An incompatible library change label Sep 10, 2015
@robpike
Copy link
Contributor

robpike commented Sep 10, 2015

Probably not good to change the definition of an identifier in Go 1. Too much code knows the rules.

@rsc
Copy link
Contributor

rsc commented Jun 17, 2017

Now tracked as #20706.

@rsc rsc closed this as completed Jun 17, 2017
@golang golang locked and limited conversation to collaborators Jun 17, 2018
@rsc rsc unassigned robpike Jun 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge LanguageChange Suggested changes to the Go language Thinking v2 An incompatible library change
Projects
None yet
Development

No branches or pull requests

6 participants