digitalmars.D.learn - Can I rely on format returned by fullyQualifiedName?
- Jack (19/19) Apr 23 2021 Can I rely on this format from fullyQualifiedName? for example,
- Mike Parker (6/15) Apr 23 2021 You can rely on the order, but you cannot expect any of the names
- Jack (3/21) Apr 24 2021 thank you Mike, having sure I can rely on the other is enough to
Can I rely on this format from fullyQualifiedName? for example, let's say I do: ```d enum s = fullyQualifiedName!f.split; ``` where f is a function member of a class. Can I realy that s[0] is the module name, s[1] is the class name and s[2] the functio name? is this standard or can the compile change that? I've tested on dmd, does ldc or gdc do something different? ```d class A { void f() { } void baa() { enum s = fullyQualifiedName!f.split; } } ```
Apr 23 2021
On Saturday, 24 April 2021 at 03:40:20 UTC, Jack wrote:Can I rely on this format from fullyQualifiedName? for example, let's say I do: ```d enum s = fullyQualifiedName!f.split; ``` where f is a function member of a class. Can I realy that s[0] is the module name, s[1] is the class name and s[2] the functio name? is this standard or can the compile change that? I've tested on dmd, does ldc or gdc do something different?You can rely on the order, but you cannot expect any of the names to be at a specific index. The FQN includes the symbol's entire hierarchy. So you could have one or more package names in front of the module name. Essentially: {all.package.names.}moduleName.{struct/class/functionName}.symbolName
Apr 23 2021
On Saturday, 24 April 2021 at 04:09:15 UTC, Mike Parker wrote:On Saturday, 24 April 2021 at 03:40:20 UTC, Jack wrote:thank you Mike, having sure I can rely on the other is enough to meCan I rely on this format from fullyQualifiedName? for example, let's say I do: ```d enum s = fullyQualifiedName!f.split; ``` where f is a function member of a class. Can I realy that s[0] is the module name, s[1] is the class name and s[2] the functio name? is this standard or can the compile change that? I've tested on dmd, does ldc or gdc do something different?You can rely on the order, but you cannot expect any of the names to be at a specific index. The FQN includes the symbol's entire hierarchy. So you could have one or more package names in front of the module name. Essentially: {all.package.names.}moduleName.{struct/class/functionName}.symbolName
Apr 24 2021