Path: utzoo!attcan!utgpu!watmath!iuvax!rutgers!cmcl2!dasys1!aj-mberg From: aj-mberg@dasys1.UUCP (Micha Berger) Newsgroups: comp.lang.icon Subject: Re: var params Message-ID: <10746@dasys1.UUCP> Date: 21 Sep 89 17:15:33 GMT References: <1027@m3.mfci.UUCP> Reply-To: aj-mberg@dasys1.UUCP (Micha Berger) Distribution: comp Organization: AishDas Society: 73-32 173 St, Hillcrest NY 11366 (718)380-7572 Lines: 22 "var" params, as you call it, is normally called "passing by reference. What this means is that you're passing the variable, not the value it holds. "var" is just the keyword Pascal uses, it's not the standard term. (The type of passing ICON allows is "pass-by-value"; i.e. only the value is passed.) Now, back to your question.... Passing by reference is considered by most language feature as dangerous. It allows a function to change the value of a variable without the user realizing. If you came back to your program years later, will you remember all the side effects? The problem is that you can end up with p(a)+a <> a+p(a). If p's parameter is passed by reference, and p changes the value of a, it makes a difference which gets done first. If you want to return a bunch of values from one function, why not return a list? -- Micha Berger ...cucard!dasys1!aj-mberg Imitatio Dei means never having to say "I'm sorry."