digitalmars.D.learn - Source File and Position of User Defined Type
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (3/3) Jun 10 2014 Is there a way to, programatically (trait), lookup the source
- Matt (5/8) Jun 11 2014 I don't know about the source file, per se, but std.traits has
- Kapps (4/7) Jun 11 2014 I don't believe this is possible. Perhaps you would be able to
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (6/7) Jun 11 2014 How about adding
Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically?
Jun 10 2014
On Tuesday, 10 June 2014 at 20:58:41 UTC, Nordlöw wrote:Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically?I don't know about the source file, per se, but std.traits has the fullQualifiedName!() template, which you could go on to parse for the package and module of a type. Or just use the packageName and moduleName templates instead.
Jun 11 2014
On Tuesday, 10 June 2014 at 20:58:41 UTC, Nordlöw wrote:Is there a way to, programatically (trait), lookup the source file and position of a user defined type either dynamically or, even better, statically?I don't believe this is possible. Perhaps you would be able to generate the .json file and use that at runtime, but I don't know if even that will handle situations like using mixins.
Jun 11 2014
I don't believe this is possible. Perhaps you would be able toHow about adding __traits(sourceFile, T) __traits(sourceLine, T) __traits(sourceColumn, T) to DMD? T of course must be a user-defined type.
Jun 11 2014