[Issue 18472] [Reg 2.078] betterC: cannot use format at compile time.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 15 23:26:14 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18472
--- Comment #6 from Mike Franklin <slavo5150 at yahoo.com> ---
(In reply to Rainer Schuetze from comment #5)
> Here's a simpler test case:
>
> module betterc;
> enum b = typeid(size_t) is typeid(uint);
At https://dlang.org/spec/betterc.html under the "Not Available" section:
> 2. TypeInfo and ModuleInfo
So, it is by design that any call to `typeid` is going to fail when compiled
with `-betterC`.
This specific issue is about not being able to use `format` in `-betterC`.
Perhaps the reason for that is because `format` relies on runtime type
information (i.e. TypeInfo). So the solution, specific to this issue, would
not be allow uses of `typeid` in `-betterC`, but rather to remove the
dependency of `format` on runtime type information (if that's even possible).
D has excellent facilities for doing introspection at compile-time, so it may
be possible to look to those facilities in concert with templates to find a
solution that does not rely on runtime type information.
It would likely also help to begin replacing compiler-generated calls to
runtime hooks that depend on `TypeInfo` with templates.
See also https://forum.dlang.org/post/mr7a65$2hc$1@digitalmars.com
--
More information about the Digitalmars-d-bugs
mailing list