Project

General

Profile

ActionsLike0

Feature #8563

closed

Instance variable arguments

Added by sawa (Tsuyoshi Sawada) almost 12 years ago. Updated over 7 years ago.

Status:
Rejected
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 3 (1 open2 closed)

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

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Category set to syntax
  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 3.0

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Description updated (diff)
#11

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Has duplicate Feature #12578: Instance Variables Assigned In parameters ( ala Crystal? ) added
#15

Updated by nobu (Nobuyoshi Nakada) over 8 years ago

  • Has duplicate Feature #12820: Shorter syntax for assigning a method argument to an instance variable added

Updated by matz (Yukihiro Matsumoto) over 7 years ago

  • Status changed from Assigned to Rejected
ActionsLike0

Also available in: Atom PDF