Feature #18595
closedAlias `String#-@` as `String#dedup`
Description
This is a rescoped feature request for https://bugs.ruby-lang.org/issues/16295
Rationale¶
Unary operator have some precedence oddities (@headius (Charles Nutter))
This often force to use parentheses, which is awkward and breaks the chaining flow.
It's really not obvious what it does. I submitted many pull requests to various open source projects to reduce their memory footprint, and I am constantly asked what it does and I have to point to the String#-@
documentation. The last example was 3 days ago.
I believe that String#dedup
would help users discover this feature, and in projects where 3.2 is the oldest supported version, it would allow for much clearer code.
Proposal¶
It's all in the title: Alias String#-@
as String#dedup
.
Or maybe even rename String#-@
as String#dedup
, and make String#-@
the alias?
Updated by byroot (Jean Boussier) about 3 years ago
- Related to Feature #16295: Chainable aliases for String#-@ and String#+@ added
Updated by byroot (Jean Boussier) almost 3 years ago
- Status changed from Open to Closed
Updated by matz (Yukihiro Matsumoto) almost 3 years ago
- Related to Feature #16150: Add a way to request a frozen string from to_s added