From: "mame (Yusuke Endoh)" Date: 2012-10-27T12:52:22+09:00 Subject: [ruby-core:48446] [ruby-trunk - Feature #6841][Assigned] Shorthand for Assigning Return Value of Method to Self Issue #6841 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee changed from mame (Yusuke Endoh) to matz (Yukihiro Matsumoto) Target version changed from 2.0.0 to Next Major It requires matz's approval. My personal comment: I agree, in fact I have thought the same thing (and as I recall, unak implemented a patch). But "..= to_i" resembles a variable named `to_i'. I wonder if matz is interested or not. -- Yusuke Endoh ---------------------------------------- Feature #6841: Shorthand for Assigning Return Value of Method to Self https://bugs.ruby-lang.org/issues/6841#change-31774 Author: wardrop (Tom Wardrop) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: Next Major =begin Quite often in Ruby, I find myself doing something like: (({my_var[:foo][:bar] = my_var[:foo][:bar].to_i})) or (({obj.foo.bar = obj.foo.bar.to_i})). Realising this, I thought of what would be a fairly nice shorthand syntax for this, which could be: (({my_var[:foo][:bar] .= to_i})). How this works should be pretty self-explanatory. The (({.=})) operator works exactly like any other assignment operator of this nature. Would be nice to see this in Ruby 2.0. Wondering what others think of this? =end -- http://bugs.ruby-lang.org/