B Revzin - if const expr isn't broken (was Re: My Meeting C++ Keynote video is now available)
Mark
smarksc at gmail.com
Sat Jan 19 11:11:13 UTC 2019
On Friday, 18 January 2019 at 20:29:08 UTC, H. S. Teoh wrote:
> That would work, but it would also suffer from all the same
> problems as macro-based programming in C. The compiler would
> be unable to detect when you accidentally pasted type names
> together where you intended to be separate, the strings may not
> actually represent real types, and generating code from pasting
> / manipulating strings is very error-prone. And you could write
> very unmaintainable code like pasting partial tokens together
> as strings, etc., which makes it hard for anyone else
> (including yourself after 3 months) to understand just what the
> code is trying to do.
>
> Generally, you want some level of syntactic / semantic
> enforcement by the compiler when you manipulate lists (or
> whatever other structures) of types.
>
>
> T
Well, it's the approach Andrei laid out in his DConf 2018 talk:
https://youtu.be/-0jcE9B5kjs?t=2641
The advantage is how simple it is, and that it only uses existing
language constructs. But, indeed, the problems you mention are
not insignificant.
More information about the Digitalmars-d-announce
mailing list