Reassigning a method parameter

Hi,I was looking at the new features of eclipse 3.2's JDT and in there they have mentioned that re-assigning a parameter is considered a poor practice.Why?
[177 byte] By [sri1025a] at [2007-10-3 5:45:18]
# 1

There are two main motivations against reassigning parameters:

1) Reusing a parameter to store e.g. a temporary result adds to the complexity of the method body in isolation. Although this added complexity is in most cases rather minor because decent guidelines tend to demand method bodies to be short enough to be simple anyway, it is nevertheless a valid reason.

2) Such a reassignment is not reflected in the caller's variable, because it was passed by value. This can be a source of confusion to some beginners who expect the reassignment to affect the caller's variable, which would be the case if Java passed by reference.

Lokoa at 2007-7-14 23:53:32 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

> 2) Such a reassignment is not reflected in the

> caller's variable, because it was passed by value.

not exclusive. you need to provide evidence that it is passed by value.

> This can be a source of confusion to some beginners

why this could be a source of confusion? people have been passing pointers for hundred years, pointers can be reasigned, who was ever confused? maybe you, as you are a beginer or a valoo...

as a matter of fact, many people prefer passing by pointers rather than passing references under similar conditions simply because pointers can be reasigned.

Lokoa at 2007-7-14 23:53:32 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> not exclusive. you need to provide evidence that it

> is passed by value.

We already have provided such evidence. You have provided nothing to the contrary. Nor have you answered the following question (among others):

You said "ialod iastor for primitves". The VM spec states clearly that iload and istore instructions work only on int values (a subset of "primitves"). The iaload and iastore instructions are for loading and storing int values in an array. There is no "ialod" instruction. There is no "iastor" instruction. What instructions were you talking about?

> why this could be a source of confusion?

Because people such as yourself assume that because Java passes something called a "reference" and/or because passing a Java reference by value superficially resembles pass-by-reference semantics, Java supports pass-by-reference (which, of course, it does not).

While we're on the subject of your confusion, you said "new never pushes anything anywhere". The VM spec states clearly that new pushes a value on the operand stack, regardless of context. Why do you think new "never pushes anything anywhere"?

~

yawmarka at 2007-7-14 23:53:32 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

> > 2) Such a reassignment is not reflected in the

> > caller's variable, because it was passed by value.

>

> not exclusive. you need to provide evidence that it

> is passed by value.

You forgot that the burden of proof is on you. One of your last attempts ended when you plagiarized a source that contradicts your own argument.

Lokoa at 2007-7-14 23:53:32 > top of Java-index,Other Topics,Patterns & OO Design...