Issue #8563 has been updated by boris_stitnicky (Boris Stitnicky).


@Matz: If `define_attr_initialize` is an option, then there is a question of named / ordered qualifier, either as:

    define_attr_initialize :foo, :bar, as: :named
    define_attr_initialize :baz, :quux, as: :ordered

or as (and I like this second option better):

    attr_init_named :foo, :bar
    attr_init_ordered :baz, :quux

Both of these would obviously stand for:

    def initialize( @baz, @quux, @foo: nil, @bar: nil )
      ...

Besides that, I feel that `attr_reader`, `attr_writer`, `attr_accessor` could use:

    attr_reader :foo, :bar, initialize: :named
    attr_reader :baz, :quux, initialize: :ordered

Which also brings to my mind, that now that we have named args firmly in place, following
syntactic flavors of `Module#attr_...` beg to exist:

    attr_reader foo: 42, bar: 43  # specifying starting values explicitly
----------------------------------------
Feature #8563: Instance variable arguments
https://bugs.ruby-lang.org/issues/8563#change-40094

Author: sawa (Tsuyoshi Sawada)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: syntax
Target version: Next Major


=begin
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.
=end



-- 
http://bugs.ruby-lang.org/