"Robert Klemme" <bob.news / gmx.net> wrote: >>> <soapbox> >>> It still might be worthwile, I just get the feeling that people try to >>> stuff things from other programming languages into Ruby because they >>> found them cute / useful / the only way to solve certain things in that >>> language. IMHO programming languages are different for a reason and >>> often it's much better to adhere to the old saying "when in Rome do as >>> the Romans do"... :-) >>> </soapbox> > "Dave Burt" <dave / burt.id.au> schrieb: >> I don't think what I've done here is anything like that. > I had to place that comment in some of these threads that I feel we're > seing more and more recently. I probably didn't pick the most appropriate > one... :-) There are two reasons I like these threads. The first is that when Perl- or C- or Whatever-thinkers ask these questions to this list, they will be exposed to the Ruby Way of solving a class of problems, and helped to free their mind. Secondly, Ruby's a great language to push around and mould to your own whim as a programmer. It's a great language to create DSLs in. These interesting hacks are not going to displace the Ruby Way, but they help expand my thinking in a similar way to learning Ruby (where I learned to routinely use closures and meta-programming). >> ... all I'm proposing is a new container, for a single object. >> >> And I think Austin's PDF::Writer example is one case where it's useful >> (that is, passing an object by reference into a method so the method can >> replace the object). > > Yuck, may well be. On a side note, the fact that ruby methods can return > an arbitrary number of objects is a really great thing, that can also help > with some of these replacement problems. Heh, I think that's Austin's view, too. He seems to badly want to rewrite it :) Anyway, multiple returns are interesting. You get an extra container there, too (My Ref is just an extra container). They're often quite disobvious, and I'm sure there are cases where it would seem more obvious to modify an argument "in-place", even though "that's not possible in Ruby". Cheers, Dave