I do not think this is possible in modern languages. A possible scenario is as follows:
void doSomething(String objectId) {
BusinessObject obj = findBusinessObject(objectId);
undef objectId;
}
Another scenario is when you implement a method from the interface, and want you to not use one of the parameters, especially in long methods.
Object get(int index, Object defaultValue) {
undef index, defaultValue;
return "constant default value";
}
This will also serve as documentation that the programmer thought about these unused parameters.
source
share