Question: how to make private module inside Object class?

let me just explains the big picture first, then give small example.

When using standard modules, I had one module, and number of smaller modules, all private to the main module. This worked well.

Each sub module, can only be accessed from the top module, which is seen by user. The sub modules can't be called by user directly.

Now I changed the main module to become an object (since I want to make more instances of it).

I want to still use the code in those submodules I had, but want to keep them private to the object class, so they can be seen only from inside the object class methods. So they are part of the object class now. But remain as modules. I do not want to copy all those methods in these submodules and put them in the object class directly.

But I can't get the syntax right to do this. I do not want to modify the code inside the sub-modules, but only how to integrate them into the object.

Notice that I can call those external modules fine from the object, but I simply want to make them private to the object class, so they can't be called from outside. 

The question is how to do this? 

Here is a very small example. (in practice, I have these submodules in .mpl files, but here I put them all in the example).

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);#this call does not work
      end proc;

      #this is module, that I want to be private to this class only
      #eventually, I'd like this module be in separate mpl file also.
      local big_car::static :=module()  #module does not take arguments!

            #this below should be private only to the this module
            #and not seen by the enclosing object.
            local big_car_name::string:="UNKNOWN";  

            #this export to allow parent object to call it
            export set_name::static:=proc(o::car_class,_name::string)
                   o:-big_car:-big_car_name:=_name;
            end proc;

      end module;

end module:

o:=Object(car_class);
o:-set_name(o,"GM");

Error, (in set_name) module `car_class` does not export `big_car`

I found after playing more with it, that this works

I just replaced o:-big_car:-big_car_name:=_name;  with big_car:-big_car_name:=_name; had to remove ::static from definition of proc inside the private module.

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);
      end proc;

      local big_car::static  :=module() 
          local big_car_name::string:="UNKNOWN";  

          export set_name:=proc(o::car_class,_name::string)
              big_car_name:=_name;
          end proc;

     end module;
end module:

Now it works. However, maple help says "In Maple, method names should be declared as static. "

Please Wait...