[Issue 23655] New: __traits(toType) shatters modularity

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 26 21:02:41 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23655

          Issue ID: 23655
           Summary: __traits(toType) shatters modularity
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: destructionator at gmail.com

This might not technically be a bug since the spec says "a type that has been
seen by the implementation" but this is is a bad feature regardless.

```
struct S {};

alias t = __traits(toType, "S6totype1S");
```

then make a totype.d with `struct S {}`

compile:

$ dmd totype2.d
totype2.d(3): Error: cannot determine `__traits(toType, "S6totype1S")`


then compile:

$ dmd totype.d totype2.d
fine!


then compile:
$ dmd totype2.d totype.d
totype2.d(3): Error: cannot determine `__traits(toType, "S6totype1S")`


D has very few features that cross modules like this and they're bad to have.
We should start removing these things, especially when they are unused and
unnecessary, to remove potential for more serious order of eval bugs arising
from them.

--


More information about the Digitalmars-d-bugs mailing list