[ruby-core:74071] [Ruby trunk Bug#12128][Rejected] Strings in `ARGV` are frozen

From: nobu@...
Date: 2016-03-01 02:09:40 UTC
List: ruby-core #74071
Issue #12128 has been updated by Nobuyoshi Nakada.

Status changed from Open to Rejected

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

* Author: Tsuyoshi Sawada
* Status: Rejected
* 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:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next