From: Jean-Hugues ROBERT Date: 2004-05-01T05:37:55+09:00 Subject: Re: def [](v) xx; return yy; end # returned value is ignored !? At 02:56 01/05/2004 +0900, you wrote: >On Apr 30, 2004, at 9:12 AM, Jean-Hugues ROBERT wrote: > >>Am I missing something ? > >Short answer: assignment always returns the value assigned, regardless of >the return value of the function assigned to. OK. I guess I have to accept that. >If you REALLY need to get around this, try: > > Test.new.send(:[]=, "hello") > >This eliminates the actual assignment, and treats it as a simple method >call. The return value is respected. OK. Thanks. I actually don't want to avoid the actual assignment, I want to control what get assigned. This send() gets rid of the syntax sugar of the compiler where (x[y]=z) becomes (tmp = z, x.[]=( y, tmp), tmp) If compiler/language was to assume that .[]= does what it is supposed to do and knows what it does, it would save some CPU cycles. Many thanks, Yours, Jean-Hugues >HTH, >--Mark ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17