Project

General

Profile

Actions

Bug #12128

closed

Strings in `ARGV` are frozen

Added by sawa (Tsuyoshi Sawada) over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:74057]

Description

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:

#!/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?

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0