[ruby-core:92349] [Ruby trunk Bug#15764] Whitespace and control characters should not be permitted in tokens

From: duerst@...
Date: 2019-04-21 02:40:57 UTC
List: ruby-core #92349
Issue #15764 has been updated by duerst (Martin Dst).


Some points from a discussion at the Fukuoka post-RubyKaigi event:

- It might make sense to allow emoji as variable names (just for fun)

- Python also limits non-ASCII identifiers. See https://docs.python.org/3/reference/lexical_analysis.html#identifiers. What they do is based on UAX #31, and applies NFKC during parsing.

----------------------------------------
Bug #15764: Whitespace and control characters should not be permitted in tokens
https://bugs.ruby-lang.org/issues/15764#change-77695

* Author: BatmanAoD (Kyle Strand)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
As of Ruby 2.5.1p57, it appears that all valid Unicode code-points above 128 are permitted in tokens. This includes whitespace and control characters.

This was demonstrated here: https://gist.github.com/qrohlf/7045823

I have attached the raw download from the above gist.

The issue has been discussed on StackOverflow: https://stackoverflow.com/q/34455427/1858225

I would say this is arguably a bug, but I am marking this ticket as a "feature" since the current behavior could be considered by-design.

---Files--------------------------------
helloworld.rb (543 Bytes)


-- 
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