Issue #12128 has been reported by Tsuyoshi Sawada.

----------------------------------------
Bug #12128: Strings in `ARGV` are frozen
https://bugs.ruby-lang.org/issues/12128

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: 2.3
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
It is not clear how the frozen status of strings in `ARGV` are to be described, but regardless of what I try to do (i.e. set frozen string pragma as false, which is probably irrelevant because the strings are already created at the time of file load), the strings appear frozen. I ran the following file `foo.rb` as `ruby foo.rb bar`:

~~~RUBY
#!/usr/bin/env ruby
# frozen_string_literal: false
ARGV.first.frozen? #=> true
ARGV.first.upcase! #=> can't modify frozen String (RuntimeError)
~~~

I believe this is a bug. If not, I would like to know what determines the frozen status of the strings in `ARGV`. Is it a feature that they are always frozen?



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