Full path of a datatype or a function


#1

Hi,

I would like to get the full path of a data type
like
for Int it would be Base.Int

for a user defined datatype named MyDT in module X.Y.Z, it would be X.Y.Z.MyDT

is there a function which does that?

Thanks


Fullpath of a type
#2

The module of a type could be determined from T.name.module. The module of a function is just the module of the type of the function. The module of a method is in the module field of the Method as well.

Given the module, you can determine the fullly qualified name using fullname.

Note that,

  1. this is usually NOT a good way to access a type/function/to generate code in a macro.
  2. For Int it’s Core, not Base.

#3

Do you have any better methods to recommend to the OP?
Also, why is it not a good way to access the type/function in that circumstance?
That might be useful information.
(Thanks in advance!)