C vs C++ vs Lisp (156)

103 Name: dmpk2k!hinhT6kz2E : 2008-08-14 04:56 ID:Heaven

> Its better encapsulated to change the object in the function that is repsonible for making the change,

What details about the change are you exposing by assigning from a return?

> instead of creating a copy of the object and setting it in the scope of the call.

This makes explicit that there was change, but doesn't say what was changed in the object or how. I don't see what you gain by hiding this fact.

> The actual change of foo happens in the calling scope if its a value and bar return the result.

Sure, but as I've argued above I believe this is superior. It guarantees that the fact there was a change is known, although not what the change was. There's much less chance you'll break something by reordering calls.

Hell, I'll go even further and say that single-assignment is a good idea. Then there's zero chance you'll break something by reordering, since you can't reuse a variable name. Of course, that's mutually exclusive with loops, so it only works in languages that use recursion solely.

This thread has been closed. You cannot post in this thread any longer.