On Thu, 27 Jan 2005, Trans wrote: > Curt Sampson wrote: >> Actually, you need pass by reference for arguments where you want the >> function to have side-effects affecting that argument. > > That's my point. I'm not sure we do NEED them. Side-effects are exactly > the couse of concern which leads to more bugs and thus unreliable > software. Indeed. I'm coming more and more over toward the functional side. >> I think a much better way of getting the kind of "reliability" you're >> talking about is to always pass by reference, but wherever you can, use >> value objects. > > Hm... but doesn;t that still leave it all up to the programmer? Sure, but it's not hard if that's how the programming culture works. And the only option beyond that is to make ruby purely functional, so that it's impossible to have side-effects. Not even Scheme went that far. > And it is terribly inefficient. Again, I don't buy this. Show me some proof. > But I'm hinting at transcending this in a way with regards to argument > passing. Arguments would become as if immutable (and side effect must > enforce a duplication) unless it was seen that the passed object was > returning on output from the same place it came from on input. Does > that make sense? I understand that, but I don't like it because it's no longer simple. For example, when I read "a.foo(b, c)", which argument allows side-effects? Or is it neither? You have to go track down the definition of foo to see what it returns, since there's no indication in that bit of code. cjs -- Curt Sampson <cjs / cynic.net> +81 90 7737 2974 http://www.NetBSD.org Make up enjoying your city life...produced by BIC CAMERA