Title: a non-ASCII uppercase letter must start a CONSTANT, not a local variable · Issue #57 · go-ruby-parser/parser · GitHub
Open Graph Title: a non-ASCII uppercase letter must start a CONSTANT, not a local variable · Issue #57 · go-ruby-parser/parser
X Title: a non-ASCII uppercase letter must start a CONSTANT, not a local variable · Issue #57 · go-ruby-parser/parser
Description: A name beginning with a non-ASCII uppercase letter is a constant in Ruby. The parser classifies it as an ordinary identifier, so the assignment creates a local variable and no constant exists afterwards. Measured against /usr/bin/ruby (2...
Open Graph Description: A name beginning with a non-ASCII uppercase letter is a constant in Ruby. The parser classifies it as an ordinary identifier, so the assignment creates a local variable and no constant exists after...
X Description: A name beginning with a non-ASCII uppercase letter is a constant in Ruby. The parser classifies it as an ordinary identifier, so the assignment creates a local variable and no constant exists after...
Opengraph URL: https://github.com/go-ruby-parser/parser/issues/57
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"a non-ASCII uppercase letter must start a CONSTANT, not a local variable","articleBody":"A name beginning with a non-ASCII **uppercase** letter is a constant in Ruby.\nThe parser classifies it as an ordinary identifier, so the assignment creates a\nlocal variable and no constant exists afterwards.\n\nMeasured against `/usr/bin/ruby` (2.6.10) and `rbgo` built from\n`go-embedded-ruby/ruby@main`, same source both times:\n\n```ruby\nFOO_Y = 1\nputs defined?(FOO_Y).inspect # both: \"constant\"\n\neval(\"ἍDD = 2\")\nputs eval('defined?(ἍDD)').inspect # MRI: \"constant\" rbgo: nil\nputs Object.const_defined?(:ἍDD) # MRI: true rbgo: false\n```\n\n`Ἅ` is U+1F0D, GREEK CAPITAL LETTER ALPHA WITH PSILI AND OXIA — an uppercase\nletter outside ASCII. The lowercase side is already right: `μ = 1` is a local\nvariable on both engines, and `defined?` agrees.\n\n## The rule\n\nMRI's lexer decides constant-ness from the first character's CASE, not from its\nbeing in `A-Z`. parse.y reaches `tCONSTANT` for any identifier whose first\ncharacter is uppercase, and for a multibyte character that question is answered\nby the encoding's case table rather than by a byte range — which is why\n`ἍBB` is a constant and `μm` is not.\n\n## Why it surfaced\n\nruby/spec's `language/variables_spec.rb:885`:\n\n```ruby\nit 'parses a non-ASCII upcased character as a constant identifier' do\n -> { eval(\"def test\\n ἍBB = 1\\nend\") }.should.raise(SyntaxError, /dynamic constant assignment/)\nend\n```\n\nThe example needs two things that are missing in two different places: this\nclassification, and a `dynamic constant assignment` check in\ngo-embedded-ruby/ruby's compiler (filed there). Fixing either one alone leaves\nthe example failing, so this is not blocked on that one and that one is not\nblocked on this.\n\n## Scope note\n\nThe companion question — which characters count as uppercase for an identifier\nstart — is worth settling from Ruby's own table rather than from Go's\n`unicode.IsUpper`, since the two need not agree on titlecase characters\n(`Dž`/`dž`/`DŽ`) or on letters with no case at all (CJK, Hebrew, Arabic), and an\nidentifier starting with a caseless letter is a LOCAL variable in Ruby, not a\nconstant. A test over one character from each of those three groups would pin it.\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n","author":{"url":"https://github.com/tannevaled","@type":"Person","name":"tannevaled"},"datePublished":"2026-11-01T09:41:24Z","url":"https://github.com/go-ruby-parser/parser/issues/57"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:79c2faac-8406-ebda-d915-72779ab7e29d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD06:90D70:1332181:191FF3C:6B040284 |
| html-safe-nonce | e0d414b61df19b96dc141c3320df862fa27a080bb0d1afa261ac65d147585b78 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDA2OjkwRDcwOjEzMzIxODE6MTkxRkYzQzo2QjA0MDI4NCIsInZpc2l0b3JfaWQiOiI1MDE4MjI4MzU3MjM4ODgyOTQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | aec3f4e368476202a99f73a4c4cb0f35c990ddec5027ca343a2b7cad3be4b711 |
| hovercard-subject-tag | issue:6145005654 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/go-ruby-parser/parser/57/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d151838740047cce5d4b3c574ef65f299c0b0693add1d8d125b526298a7765a6/go-ruby-parser/parser/issues/57 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d151838740047cce5d4b3c574ef65f299c0b0693add1d8d125b526298a7765a6/go-ruby-parser/parser/issues/57 |
| og:image:alt | A name beginning with a non-ASCII uppercase letter is a constant in Ruby. The parser classifies it as an ordinary identifier, so the assignment creates a local variable and no constant exists after... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tannevaled |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/go-ruby-parser/parser git https://github.com/go-ruby-parser/parser.git |
| octolytics-dimension-user_id | 295635196 |
| octolytics-dimension-user_login | go-ruby-parser |
| octolytics-dimension-repository_id | 1276240137 |
| octolytics-dimension-repository_nwo | go-ruby-parser/parser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1276240137 |
| octolytics-dimension-repository_network_root_nwo | go-ruby-parser/parser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width