<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Bug in CodeTools:-EncodeName / DecodeName?</title>
    <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 13:38:53 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 13:38:53 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Bug in CodeTools:-EncodeName / DecodeName?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Bug in CodeTools:-EncodeName / DecodeName?</title>
      <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName</link>
    </image>
    <item>
      <title>named modules</title>
      <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName?ref=Feed:MaplePrimes:Bug in CodeTools:-EncodeName / DecodeName?:Comments#answer130548</link>
      <itunes:summary>&lt;p&gt;Could you try making your module a named module ? (There seemed to be a hint, in the debugger, at the juncture where it went wrong.)&lt;/p&gt;
&lt;pre&gt;restart:
with(CodeTools):

M := module m() option package; export f; f := proc() end proc; end module;

         module m () export f; option package; end module

EncodeName(M:-f);

_Inert_ASSIGNEDLOCALNAME("f", "PROC", 0, _Inert_ATTRIBUTE(

  _Inert_EXPSEQ(_Inert_EQUATION(_Inert_NAME("modulename"), 

  _Inert_ASSIGNEDNAME("m", "MODULE", _Inert_ATTRIBUTE(_Inert_NAME(

  "protected", _Inert_ATTRIBUTE(_Inert_NAME("protected")))))), 

  _Inert_NAME("protected", 

  _Inert_ATTRIBUTE(_Inert_NAME("protected"))))))

DecodeName(%);

                              m:-f
&lt;/pre&gt;
&lt;p&gt;I'll have to test, but I wonder whether it would also be ok if the module was being read in from a .mla archive.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Could you try making your module a named module ? (There seemed to be a hint, in the debugger, at the juncture where it went wrong.)&lt;/p&gt;
&lt;pre&gt;restart:
with(CodeTools):

M := module m() option package; export f; f := proc() end proc; end module;

         module m () export f; option package; end module

EncodeName(M:-f);

_Inert_ASSIGNEDLOCALNAME("f", "PROC", 0, _Inert_ATTRIBUTE(

  _Inert_EXPSEQ(_Inert_EQUATION(_Inert_NAME("modulename"), 

  _Inert_ASSIGNEDNAME("m", "MODULE", _Inert_ATTRIBUTE(_Inert_NAME(

  "protected", _Inert_ATTRIBUTE(_Inert_NAME("protected")))))), 

  _Inert_NAME("protected", 

  _Inert_ATTRIBUTE(_Inert_NAME("protected"))))))

DecodeName(%);

                              m:-f
&lt;/pre&gt;
&lt;p&gt;I'll have to test, but I wonder whether it would also be ok if the module was being read in from a .mla archive.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>130548</guid>
      <pubDate>Fri, 10 Feb 2012 13:26:40 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>archived</title>
      <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName?ref=Feed:MaplePrimes:Bug in CodeTools:-EncodeName / DecodeName?:Comments#comment130549</link>
      <itunes:summary>&lt;p&gt;It also works if the module is being read in from an archive (as suspected).&lt;/p&gt;
&lt;pre&gt;restart:
with(CodeTools):
M := module() option package; export f; f := proc() end proc; end module:
EncodeName(M:-f):

DecodeName(%);
Error, (in CodeTools:-DecodeName) invalid subscript selector

LibraryTools:-Create("c:/temp/moddy.mla",WRITE);
libname:="c:/temp/moddy.mla",libname:
savelib(M);


restart:
with(CodeTools):
libname:="c:/temp/moddy.mla",libname:

EncodeName(M:-f);
_Inert_ASSIGNEDLOCALNAME("f", "PROC", 0, _Inert_ATTRIBUTE(

  _Inert_EXPSEQ(_Inert_NAME("protected", 

  _Inert_ATTRIBUTE(_Inert_NAME("protected"))), _Inert_EQUATION(

  _Inert_NAME("modulename"), _Inert_ASSIGNEDNAME("M", "MODULE"))))

  )

DecodeName(%);
                              M:-f
&lt;/pre&gt;
&lt;p&gt;And now I read the help page for &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=CodeTools/Profiling"&gt;CodeTools:-Profiling&lt;/a&gt; and see that it is mentioned there,&lt;/p&gt;
&lt;pre&gt;        Due to difficulties in resolving names, it is not possible to profile the member
        functions of a module that is not saved in a repository.  To avoid this, simply
        create a repository using march, set savelibname, and then use savelib to save the
        module.  By adding the new repository to libname, the module is available to use
        and profile.
&lt;/pre&gt;
&lt;p&gt;I now wonder whether creating named modules (in the first place) is another viable workaround to the issue (and if so, obviating the general need to savelib and restart in order to profile module members).&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;It also works if the module is being read in from an archive (as suspected).&lt;/p&gt;
&lt;pre&gt;restart:
with(CodeTools):
M := module() option package; export f; f := proc() end proc; end module:
EncodeName(M:-f):

DecodeName(%);
Error, (in CodeTools:-DecodeName) invalid subscript selector

LibraryTools:-Create("c:/temp/moddy.mla",WRITE);
libname:="c:/temp/moddy.mla",libname:
savelib(M);


restart:
with(CodeTools):
libname:="c:/temp/moddy.mla",libname:

EncodeName(M:-f);
_Inert_ASSIGNEDLOCALNAME("f", "PROC", 0, _Inert_ATTRIBUTE(

  _Inert_EXPSEQ(_Inert_NAME("protected", 

  _Inert_ATTRIBUTE(_Inert_NAME("protected"))), _Inert_EQUATION(

  _Inert_NAME("modulename"), _Inert_ASSIGNEDNAME("M", "MODULE"))))

  )

DecodeName(%);
                              M:-f
&lt;/pre&gt;
&lt;p&gt;And now I read the help page for &lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=CodeTools/Profiling"&gt;CodeTools:-Profiling&lt;/a&gt; and see that it is mentioned there,&lt;/p&gt;
&lt;pre&gt;        Due to difficulties in resolving names, it is not possible to profile the member
        functions of a module that is not saved in a repository.  To avoid this, simply
        create a repository using march, set savelibname, and then use savelib to save the
        module.  By adding the new repository to libname, the module is available to use
        and profile.
&lt;/pre&gt;
&lt;p&gt;I now wonder whether creating named modules (in the first place) is another viable workaround to the issue (and if so, obviating the general need to savelib and restart in order to profile module members).&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>130549</guid>
      <pubDate>Fri, 10 Feb 2012 13:34:45 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Thanks, it works!</title>
      <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName?ref=Feed:MaplePrimes:Bug in CodeTools:-EncodeName / DecodeName?:Comments#comment130555</link>
      <itunes:summary>&lt;p&gt;Thanks for the pointers.&amp;nbsp; I hadn't spotted that caveat in the Profiling help page, as the exception was being raised in other places like CodeTools:-Profiling:-Coverage:-Print,&amp;nbsp; CodeTools:-DecodeName and the like.&amp;nbsp; I've tried the named module suggestion, and it looks like it's going to work, without the nuisance of putting the module into a repository.&lt;/p&gt;
&lt;p&gt;It could be that the two workarounds you suggested are related. The help page for module,named says: "Every module that is saved to a repository is given a name (that under which it was saved) for use by the persistent store."&amp;nbsp; So perhaps the reason why packages in the repository work is that they are named?&lt;/p&gt;
&lt;p&gt;In fact we had a third workaround, along the following lines...&lt;/p&gt;
&lt;pre&gt;m := module() option package; export f; f := proc() end proc; end module;&lt;br&gt;fcopy := op(m:-f);&lt;br&gt;[now work with fcopy for profiling purposes]&lt;/pre&gt;
&lt;p&gt;But named module is cleaner.&amp;nbsp; Thanks again for your help, we now have something we can work with.&lt;/p&gt;
&lt;p&gt;Ian.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks for the pointers.&amp;nbsp; I hadn't spotted that caveat in the Profiling help page, as the exception was being raised in other places like CodeTools:-Profiling:-Coverage:-Print,&amp;nbsp; CodeTools:-DecodeName and the like.&amp;nbsp; I've tried the named module suggestion, and it looks like it's going to work, without the nuisance of putting the module into a repository.&lt;/p&gt;
&lt;p&gt;It could be that the two workarounds you suggested are related. The help page for module,named says: "Every module that is saved to a repository is given a name (that under which it was saved) for use by the persistent store."&amp;nbsp; So perhaps the reason why packages in the repository work is that they are named?&lt;/p&gt;
&lt;p&gt;In fact we had a third workaround, along the following lines...&lt;/p&gt;
&lt;pre&gt;m := module() option package; export f; f := proc() end proc; end module;&lt;br&gt;fcopy := op(m:-f);&lt;br&gt;[now work with fcopy for profiling purposes]&lt;/pre&gt;
&lt;p&gt;But named module is cleaner.&amp;nbsp; Thanks again for your help, we now have something we can work with.&lt;/p&gt;
&lt;p&gt;Ian.&lt;/p&gt;</description>
      <guid>130555</guid>
      <pubDate>Fri, 10 Feb 2012 17:48:35 Z</pubDate>
      <itunes:author>IanLisle</itunes:author>
      <author>IanLisle</author>
    </item>
    <item>
      <title>you're welcome</title>
      <link>http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName?ref=Feed:MaplePrimes:Bug in CodeTools:-EncodeName / DecodeName?:Comments#comment130556</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName#comment130555"&gt;@IanLisle&lt;/a&gt;&amp;nbsp;I'm glad that you have a solution.&lt;/p&gt;
&lt;p&gt;Yes, I knew of the savelib action's giving a name to the module, which is what made me suspect that one of the approaches might be as adequate as the other.&lt;/p&gt;
&lt;p&gt;I will submit a &lt;a href="http://www.mapleprimes.com/scr/new"&gt;Software Change Request&lt;/a&gt;, so that (if this is all true, that both work) the help-pages might indicate creation of a &lt;em&gt;named module&lt;/em&gt; as a simpler approach.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130546-Bug-In-CodeToolsEncodeName--DecodeName#comment130555"&gt;@IanLisle&lt;/a&gt;&amp;nbsp;I'm glad that you have a solution.&lt;/p&gt;
&lt;p&gt;Yes, I knew of the savelib action's giving a name to the module, which is what made me suspect that one of the approaches might be as adequate as the other.&lt;/p&gt;
&lt;p&gt;I will submit a &lt;a href="http://www.mapleprimes.com/scr/new"&gt;Software Change Request&lt;/a&gt;, so that (if this is all true, that both work) the help-pages might indicate creation of a &lt;em&gt;named module&lt;/em&gt; as a simpler approach.&lt;/p&gt;</description>
      <guid>130556</guid>
      <pubDate>Fri, 10 Feb 2012 18:35:12 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
  </channel>
</rss>