From: Pit Capitain Date: 2005-11-25T16:38:04+09:00 Subject: Re: syntax error when defining index setter []= jchris@gmail.com schrieb: > Pit, > > Thanks for the glimmer of hope. The only problem I'm finding at this > point is that "middlemen" is out of scope when result.[]= is actually > run. I tried saving self to a variable ('saved_self') and then using > saved_self.middlemen[index] to get in there, but saved_self is just out > of scope then. > > NameError: undefined local variable or method `saved_self' for > # > > Scope. hmmm, that seems like it should be a Rubyish problem to solve. > Probably with blocks or procs... Yes, I noticed it after sending the code. You'd need define_method with a block, which would have access to the local variables. But see David's code for a working implementation. (BTW: nice idea to reuse the array with the singleton method!) Regards, Pit