From: matthew@... Date: 2016-07-10T09:26:22+00:00 Subject: [ruby-core:76333] [Ruby trunk Feature#12578] Instance Variables Assigned In parameters ( ala Crystal? ) Issue #12578 has been updated by Matthew Kerwin. Here is some history of this proposal: * [#5825 Sweet instance var assignment in the object initializer](https://bugs.ruby-lang.org/issues/5825) * [#8563 Instance variable arguments](https://bugs.ruby-lang.org/issues/8563) * [#12023 Allow ivars to be used as method arguments](https://bugs.ruby-lang.org/issues/12023) ---------------------------------------- Feature #12578: Instance Variables Assigned In parameters ( ala Crystal? ) https://bugs.ruby-lang.org/issues/12578#change-59568 * Author: Matt Lankford * Status: Open * Priority: Normal * Assignee: ---------------------------------------- When I first saw the instance assignments in Crystal, I was floored... I have looked at all 18 pages in this tracker and thought it "must" have been mentioned in here... but I don't see it... pardon me if I missed it... BUT so in Crystal, this : class MyStuff def initialize @thing_one , @thing_two end end would replace : class MyStuff def initialize thing_one , thing_two @thing_one = thing_one @thing_two = thing_two end end One of the things I loved about ruby was attr_accessor / reader / writer... I know in Crystal, it is a macro, but still at the millions of lines of boilerplate that would go away... Has no one thought of stealing this from Crystal or is there a good reason this does not exist? ( and I will go sit down and color now ) -- https://bugs.ruby-lang.org/ Unsubscribe: