Question: Maple object appliable as operator: Why does thismodule act differently in library code?

March 18 2014 IanLisle 73
Maple 17


Hi all,

We're programming with Maple objects, and would like to have a Maple object that is appliable (i.e. acts as an operator).  We're really after partial differential operator (PDO) objects, but I give a simpler example below.  The problem is this: the ?ModuleApply proc needs to be non-static (so that each object has its own ?ModuleApply), and it may want to refer to the object instance, via ?thismodule.  Code like this works great when it is typed at the command line or read in from .mpl file, but it barfs as soon as saved to a .mla.  Why is that?  And is there an easy fix / workaround?


Here is an example worksheet, that creates a basic "compute mod p" object

The issue seems to be that, for code typed at command line, ?thismodule is resolved when I would expect, i.e. in the instance object; but saving to the .mla seems to cause ?thismodule to be resolved then-and-there, which means it resolves to the prototype object.  For this particular case there is an easy workaround, but we really want to refer to ?thismodule if possible.  Is there a way to do that?

BTW I'm running Maple 17.02 (sorry don't have access to 18 yet).

Ian and Tracy

Please Wait...