------ art_17237_19830548.1212849297620 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 6/7/08, Robert Klemme <shortcutter / googlemail.com> wrote: > On 07.06.2008 04:30, Eric Mahurin wrote: > > > On Fri, Jun 6, 2008 at 10:49 AM, Robert Klemme > > <shortcutter / googlemail.com> wrote: > > > > > On 06.06.2008 17:01, Eric Mahurin wrote: > > > > > > > another solution: a) pass the node containing the link you want to > > > > operate along with something saying which link in the node (you'll > > > > probably also need a dummy node at the root/head), b) have a separate > > > > object for the link so you can pass it around (i.e. simply an Array of > > > > one element), c) pass a lambda that can modify the link. None of > > > > these are as elegant as an lvalue reference IMHO. In my early ruby > > > > days a few years ago I put some code in the rubyforge "reference" > > > > project. I still think having something like this readily available > > > > would be useful. > > > > > > > The usual solution in Ruby would probably be a) which I find perfectly > ok. > > > Since the manipulation is typically encapsulated inside a LinkedList > class > > > it does not bother me too much if there are two additional elements (for > > > head and tail). :-) But I can see how this might be a bit more elegant > with > > > references (although not as much to create an urgent need for references > in > > > Ruby). :-) > > > > > > > Definitely no urgent need, but a nice thing to have in a bag of > > tricks. It could be implemented in Ruby, but you'll get more > > efficiency if done in C (ruby implementation would typically need eval > > - at least for local vars). No special syntax needed. > > > > Acutally, there *is* an implementation already: > > irb(main):002:0> s mpleDelegator.new nil >