ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: cianol@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91609] [Ruby trunk Bug#15616] Chained destructive methods fail when using +@to unfreeze a frozen string
Date: Fri, 22 Feb 2019 14:52:30 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-15616.20190222145228.c9eea85648ebec95@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15616.20190222145228@ruby-lang.org

Issue #15616 has been reported by cianooooo (Cian O).

----------------------------------------
Bug #15616: Chained destructive methods fail when using +@ to unfreeze a frozen string
https://bugs.ruby-lang.org/issues/15616

* Author: cianooooo (Cian O)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.1
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Using the +@ syntax to unfreeze a string does not work when chaining destructive methods

Consider the following;
``` ruby
foo = "bar".freeze
+foo.gsub!("bar", "car")
```

This raises;
``` ruby
FrozenError: can't modify frozen String
```

However, I would have expected this to work since +@ should return a duplicated mutable string.



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

       reply	other threads:[~2019-02-22 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15616.20190222145228@ruby-lang.org>
2019-02-22 14:52 ` cianol [this message]
2019-02-22 15:51 ` [ruby-core:91610] [Ruby trunk Bug#15616] Chained destructive methods fail when using +@to unfreeze a frozen string pdahorek
2019-02-25  6:14 ` [ruby-core:91619] [Ruby trunk Bug#15616] Chained destructive methods fail when using +@ to " duerst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-15616.20190222145228.c9eea85648ebec95@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).