I have:
BeginPackage["Test1`"];
ClearAll[f];
f::usage = "";
Begin["`Private`"];
f[x_AA]:= 1;
f[x_BB]:= 2;
End[];
EndPackage[];
When later, on a notebook, after the call package successful with:
<<Test1`
I always get from evaluated:
x = AA[3];
f[x]
It should be: 1
. But, actually, It is f[AA[3]]
.
The issue is same if I used x = BB[4]
;
Any idea? I don't realize how to make it works.
Print[1]
prints 1 is actually not its result, it's a side-effect. Just tryPrint[1] // FullForm
and you get Null. $\endgroup$