Question: can Maple allow object variable name to be same as object method name?

I do not remember is this was asked before.

In other OOP languages such as Java, it allows one to name object variable name same as method name. I found this example on the net for java to illustrate

class Test {

  private boolean isVal;

  public boolean isVal() {
      return isVal;
  }

}

In Maple, this is not allowed. So now I have to come up with new name for either the method or the variable that returns that hidden internal variable.

Here is an example

A:=module()
  option object;
  local is_valid::truefalse:=false;
  export is_valid::static:=proc(_self,$)::truefalse;
    return _self:-is_valid;
  end proc;
end module;

THis gives error

Error, (in A) exported variable `is_valid` cannot be multiply declared

It will be nice if Maple allows this. For now one has to rename either the variable or the method. Which is little annoying.

Is this something that could  be easily added to Maple in a future release?

Please Wait...