It seems like I should be able to treat a package data type like a C struct, but when I return a package from a procedure, I can't access any of its nested identifiers. I've also tried using importfrom(package,identifier), but that doesn't work either. Here's an example.
Code:
> proc gimmePackage()
. {
. package apack;
. int apack::anum = 1;
.
. return(apack);
. }
>
> package testpack = gimmePackage();
> listvar(testpack);
// testpack [0] package (N)
// ::anum [1] int 1
>
> testpack::anum;
? `anum` is undefined
? error occurred in STDIN line 95: `testpack::anum;`
>
> importfrom(testpack,anum);
? `anum` not found in `testpack`
? error occurred in STDIN line 96: `importfrom(testpack,anum);`
>
> importfrom(testpack,::anum);
? error occurred in STDIN line 97: `importfrom(testpack,::anum);`
? last reserved name was `importfrom`
skipping text from `anum` error at token `)`
>
> importfrom(testpack,testpack::anum);
? `anum` not found in `testpack`
? error occurred in STDIN line 98: `importfrom(testpack,testpack::anum);`
It also seems that poly data types can't be stored in (user-defined) packages. Is that correct?
Any help is greatly appreciated!