Question: Can alias be used inside a SubPackage?

I have used alias for various reasons inside a pagkage. It is useful for coupling old command names to modern ones.

I am trying now to get this to work inside a sub package but no success. Can this be done?

restart

 

pkg:=module()
option package;
export   Sqr, UHG;
alias(XX=Sqr);
#alias(eparm=CirclePramUHG);
Sqr:=proc(x)
   return x^2;
end proc;

 UHG:=module()
          option package;
         
          export
               CircleParmUHG;

alias(eparm=CirclePramUHG);

     CircleParmUHG := proc(T::algebraic, U::algebraic)
       local t, u, P, cp;
         #  P := point;
             t := T*denom(T)*denom(U);
             u := U*denom(T)*denom(U);
         # if P <> NullPoint then
         #   P := 'NullLine';
         #end if;
        if t::numeric and u::numeric and t<>0 and u<>0 then
             cp:=  <u^2 - t^2| 2*u*t| u^2 + t^2>/gcd(gcd(u^2 - t^2, 2*u*t), u^2 + t^2);
          else
             cp:=  <u^2 - t^2| 2*u*t| u^2 + t^2>;
        end if;
        return cp
      end proc;
    end module;
end module;

_m2044017012448

(1)

with(pkg)

[Sqr, UHG]

(2)

Sqr(4)

16

(3)

UHG:-CircleParmUHG(t,u)

[`?`]

(4)

UHG:-eparm(t,u)

Error, eparm is not a command in the pkg:-UHG package

 

with(UHG)

[CircleParmUHG]

(5)

CircleParmUHG(2,7)

Vector[row]([45, 28, 53])

(6)

eparm(2,7)

eparm(2, 7)

(7)

 

XX(3)

9

(8)
 

 

Download 2024-06-29_use_alias_in_a_Sub_Package.mw

Please Wait...