From: Peter Zotov Date: 2012-04-29T00:39:28+09:00 Subject: Re: Capital Cyrillic letter in Ruby class name (UTF-8) Vladimir Kerimov писал 28.04.2012 17:02: > Brian Candler wrote in post #1057729: >> Vladimir Kerimov wrote in post #1057566: >> >> You need to take each language as a whole. If on balance you prefer >> Ruby, then use Ruby; if something else has the best combination of >> features for you (of the fewest annoyances), then use that. >> Whichever >> one gets the job done best for you. >> >> The decision that constants must start with ASCII A-Z is fundamental >> and >> unlikely to be revisited. > > All I need is suitable binding for company uses Ruby. > Condition for classes starts from ASCII A-Z for language based on > UTF-8 > is slightly strange, don't you think so? > What about Japanese letters, is it in ASCII? Or may be Greek > alphabet? > > Cyrillic and Greek letters both have a legal capital letters in > UTF-8. > This logic not differ from capital letter of Latin capital. > > So language based on UTF-8 with condition "classes and modules must > start from capital letter" must handle at least Greek and Cyrillic > letters too. > > Actually it is. If you want to stay in the logic way. Okay, you really want this to be done and you don't want to use a patched version of Ruby. (Besides that, even if you'll manage to get this change to the core, which is not very likely due to technical reasons, you'll have to wait a point release--a year or something like that.) As a Russian developer, I think the idea is stupid, but I'm a bit curious because it is, on the other hand, somewhat hard. You can achieve what you want by using gem `polyglot' and using some other suffix for your "Russian-enhancened" files (like .rbr maybe), or overriding the Kernel#load and checking for a magic comment (like # encoding:utf-8; russian-identifiers:true). Then you'll have to rewrite all constant accesses with Russian to something with a prefix (Документ->RДокумент) and load the modified file. This modification can be done with a regexp, through I'd recommend using Ripper. This is as far as you can go without modifying the interpreter. It's easy to patch the constant name verification code, but, as I've already said, the change won't appear in mainstream redistrubutables any fast. -- WBR, Peter Zotov.