Question: Bug in CodeTools:-EncodeName / DecodeName?

Is there a bug in the CodeTools:-EncodeName / DecodeName pair?

Consider the following minimal example:

with(CodeTools):
M := module() option package; export f; f := proc() end proc; end module;
EncodeName(M:-f);
DecodeName(%);

The EncodeName gives answer:

_Inert_ASSIGNEDLOCALNAME("f", "PROC", 0, _Inert_ATTRIBUTE(_Inert_NAME("protected", _Inert_ATTRIBUTE(_Inert_NAME("protected")))))

But applying DecodeName to the result throws an exception:

Error, (in CodeTools:-DecodeName) invalid subscript selector

This means that it is very difficult to do profiling and coverage for functions in a package that I write.

Note the following:

  1. The problem does not arise for proc's defined at global level, nor for proc's in a module that is not a package, nor for proc's in a maple system package like PDEtools.
  2. The proc's are correctly profiled, but calls to say Coverage:-Print fail with the above exception, because they cannot decode the proc names in the profile table.

Ian.



 

Please Wait...