[ruby-core:82672] [Ruby trunk Feature#13770] Can't create valid Cyrillic-named class/module

From: duerst@...
Date: 2017-09-06 09:54:09 UTC
List: ruby-core #82672
Issue #13770 has been updated by duerst (Martin Dürst).


sb (Sergey Borodanov) wrote:

> Same error with module creating and same behavior in **irb** (please, see attachment). At the same time Cyrillic-named constants and methods work fine.

Methods indeed should work fine, because currently all non-ASCII characters are lumped together as lower-case. But I don't think constants work fine; it may only look so.

Please try e.g.
```
ruby -e 'Мир = 55; Мир = 77'
```

You should get a warning saying the the constant was already initialized. I don't get such a warning, which means that `Мир` here is treated as a variable, not as a constant.


----------------------------------------
Feature #13770: Can't create valid Cyrillic-named class/module
https://bugs.ruby-lang.org/issues/13770#change-66502

* Author: sb (Sergey Borodanov)
* Status: Assigned
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
Can't create a valid Cyrillic-named class. If I have a file **мир.rb**:

~~~ ruby
# Content of мир.rb:

class Мир

  def приветствовать
    "Привет, Мир!"
  end

end
~~~

and do in **bash**:

~~~
ruby мир.rb
~~~

I get the error (**SyntaxError**):

~~~
мир.rb:1: class/module name must be CONSTANT
~~~

Same error with module creating and same behavior in **irb** (please, see attachment). At the same time Cyrillic-named constants and methods work fine.

It is expected that creating Cyrillic-named class/modules should work without error.

---Files--------------------------------
Screenshot from 2017-07-26 19-08-14.png (64.2 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next