"Dave Burt" <dave / burt.id.au> schrieb im Newsbeitrag news:gobfe.6148$31.690 / news-server.bigpond.net.au... > > "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. I heartily agree here. But of course this needs some form of openness on both sides, careful listening and considering arguments. Pure evangelism doesn't help. > 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). Yes, of course. However there's a difference between building a DSL and modifying fundamental behavior of the language. The second approach is the one that arouses my suspicion. >>> ... 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". Personally I prefer to not have in place modification. If you view a method as some kind of (mathematical) function, then there's an input and an output. Returning values via arguments (= input) feels a bit awkward to me. It has to be done in other languages because they don't provide multiple return values; unfortunately this can make code hard to read. But since Ruby actually has mutliple returns, I personally prefer to do it that way. Kind regards robert