Issue #14680 has been updated by matz (Yukihiro Matsumoto).

Status changed from Open to Closed

The `+@` and `-@` for strings are strongly coupled with `frozen-string-literals` magic comment. Since we don't have `frozen-array-expression` nor `frozen-hash-expression` magic comments, I don't think we have a strong reason for `+@` and `-@` methods for arrays and hashes.

Matz.


----------------------------------------
Feature #14680: Adding +@ and -@ to hash and array
https://bugs.ruby-lang.org/issues/14680#change-76711

* Author: kddeisz (Kevin Deisz)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Since we have `-@` and `+@` for strings and it's very useful (and reads better than `.freeze`) I'd like to propose adding the same API to hash and array. Especially with constants, linters are always telling me to freeze them, and I'd like to be able to accomplish that with `-@`. I've attached the necessary code to make that happen.

---Files--------------------------------
freeze.patch (3.86 KB)


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