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 03:12 01/05/2004 +0900, you wrote: >Mark Hubbart 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. >> >>If you REALLY need to get around this, try: >> >> Test.new.send(:[]=, "hello") > >Actually there's an easier way, you can just use > >Test.new.[]= "hello" > >> >>This eliminates the actual assignment, and treats it as a simple method >>call. The return value is respected. >> >>HTH, >>--Mark x.[]= y instead of x[] = y, Right. All of this is going in the opposite direction from what I need to implement a transparent Reference to a lvalue (kind of a "proxy" for a variable instead of a "proxy" for an object). Using r[] = zzz for References instead of plain x = zzz for regular variable is not very transparent, using r.[]= is even less I guess. But it does work and in the absence of anything better it is worth mentioning. Thanks. Jean-Hugues ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17