From: "Marte Raphael Y. Soliza" Date: 2007-09-24T04:25:13+09:00 Subject: Re: Wrong return value with []= ------=_Part_40286_4151856.1190575503684 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline This was the behavior before. But it has been changed since... I can't remember :). It was a design choice to ignore the return value of assignment operations because of its bad effects. On 9/24/07, Michael Neumann wrote: > > Hi, > > Take a look at the following example: > > > class Symbol > def []=(signature, body) > nil > end > end > > def method(*args) > p args > end > > method(:empty['=> bool'] = 'return @size == 0') > # => ["return @size == 0"] > > I'd expect: > > [nil] > > as I return "nil" from []= method call. > ------=_Part_40286_4151856.1190575503684 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline This was the behavior before. But it has been changed since... I can't remember :). It was a design choice to ignore the return value of assignment operations because of its bad effects.

On 9/24/07, Michael Neumann <mneumann@ntecs.de> wrote:
Hi,

Take a look at the following example:


   class Symbol
    def []=(signature, body)
      nil
    end
   end

   def method(*args)
     p args
   end

   method(:empty['=> bool'] = 'return @size == 0')
   # => ["return @size == 0"]

I'd expect:

   [nil]

as I return "nil" from []= method call.

------=_Part_40286_4151856.1190575503684--