From: Prem Sichanugrist Date: 2013-02-26T04:19:59+09:00 Subject: [ruby-core:52891] [Feedback Request] Add support for setting instance variable in method definition --512bb7a6_793753de_13c Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I would like to propose a feature to be added to Ruby. It was inspired from CoffeeScript. Before I get my hands dirty and dig in, I would like to hear it first if it's a good idea. So, I want to be able to write this method: class person def initialize(name, age) @name = name @age = age end end Into this: class person def initialize(@name, @age) end end The benefit I'm seeing here is that we're not cluttering the initializer with all those obvious instance variable assignments. I also think it's a good syntactic sugar and it make sense after I saw all the usage from CoffeeScript. If you guys thinking this is a good idea, I'll write up and submit a patch myself. Please let me know. Thank you, Prem S. --512bb7a6_793753de_13c Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Hello,

I would like to prop= ose a feature to be added to Ruby. It was inspired from CoffeeScript. Bef= ore I get my hands dirty and dig in, I would like to hear it first if it'= s a good idea.

So, I want to be able to write th= is method:

    class person
=       def initialize(name, age)
    &n= bsp;   =40name =3D name
        =40age= =3D age
      end
    end

Into this:

  &= nbsp; class person
      def initialize(=40name,= =40age)
      end
    end

The benefit I'm seeing here is that we're n= ot cluttering the initializer with all those obvious instance variable as= signments. I also think it's a good syntactic sugar and it make sense aft= er I saw all the usage from CoffeeScript.

If you= guys thinking this is a good idea, I'll write up and submit a patch myse= lf. Please let me know.

Thank you,
Prem S.
--512bb7a6_793753de_13c--