Re: Pass by Reference
- Posted by Critic Sep 13, 2009
- 2173 views
I'm not sure you understood the original point. It wasn't about "something is modified." It was specifically about the arguments passed to the routine. Any language (Ok, maybe excepting pure functional) will allow changing some variable not within the scope of the routine.
Fair enough.
Also, I'd quibble about your use of the term "global variables."
Everybody except some Euphorians calls it global variables. Of course it refers to lifetime, not necessarily scope.
Even so, I don't think this criticism makes a lot of sense. Those top level variables are often the procedural equivalent to an object's member data in OO languages.
Maybe, but in contrast to objects in OO languages, the content of global variables doesn't get garbage collected and Euphoria code is often not re-entrant due to globals. So it's clearly technically inferior.
Even in languages like Java, there is a fair amount of confusion about how arguments are passed (hint: they are passed by value).
I know. I've said multiple times, PBR is not necessary if objects have reference semantics.