Issue #14680 has been updated by kddeisz (Kevin Deisz).


I don't think it's as common these days to see `.freeze` all over the place, since the linters explicitly tell you to use the frozen string literal comment. But that's explicitly for literals. There are plenty of cases where you'd want to freeze strings without them being a literal in the code. In this case there's also plenty of occurrences where you'd want to freeze hashes and arrays without them beings literals. Maybe I should have rephrased the ticket, it's definitely not just for the benefit of lint-based development.

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

* Author: kddeisz (Kevin Deisz)
* Status: Open
* 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>