Question: type `static` does not exist error when using kernelopts('assertlevel'=2):

Someone added "Duplicate question" tag on this question.

How is this duplicate question? Where is the duplicate question? 

Is this a bug?

Accoding to this help page 

A derived class must not redeclare (via a local or export declaration) any members inherited from the base class

this example does not do this. But derived class gets an error when using ::static on a method declared in base class and this only shows up when using kernelopts('assertlevel'=2):

So it is either kernelopts('assertlevel'=2): is wrong or help is wrong.  Here is example

972100

restart;

972100

interface(version);

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

module bank_account()
  option object;
  local account_id::integer:=0;
  
  export ModuleCopy::static:=proc(_self, proto::bank_account, account_id::integer,$)
         if nargs=2 then
            _self:-account_id := proto:-account_id;
         else
            _self:-account_id := account_id;
         fi;
  end proc;
end module;

module bank_account () local account_id::integer; option object; end module

module saving_account()
  option object(bank_account);

  ModuleCopy::static := proc(_self, proto::saving_account, account_id::integer,$)
         if nargs=2 then
            _self:-account_id := proto:-account_id;
         else
            _self:-account_id := account_id;
         fi;
  end proc;
end module;

Error, (in saving_account) type `static` does not exist

 


Download static_error.mw

Removing the line kernelopts('assertlevel'=2): the error goes away. Also keeping kernelopts('assertlevel'=2): but removing the ::static from the derived class the error goes way.

What is going on?

Maple 2023 on windows 10.

Please Wait...