Project

General

Profile

Actions

Feature #8563

closed

Instance variable arguments

Added by sawa (Tsuyoshi Sawada) over 8 years ago. Updated about 4 years ago.

Status:
Rejected
Priority:
Normal
Target version:
-
[ruby-core:55596]

Description

Often times, people want to assign given arguments to instance variables, especially inside the method initialize:

def initialize foo, bar, buz
  @foo, @bar, @buz = foo, bar, buz
  ...
end

I propose to let method definition take instance variables as arguments so that:

def initialize @foo, @bar, @buz
  ...
end

would be equivalent as above.


Related issues

Is duplicate of Ruby master - Feature #5825: Sweet instance var assignment in the object initializerAssignedmatz (Yukihiro Matsumoto)Actions
Has duplicate Ruby master - Feature #12578: Instance Variables Assigned In parameters ( ala Crystal? )RejectedActions
Has duplicate Ruby master - Feature #12820: Shorter syntax for assigning a method argument to an instance variableRejectedActions
Actions

Also available in: Atom PDF