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.


Well, it's the approach Andrei laid out in his DConf 2018 talk:

The advantage is how simple it is, and that it only uses existing language constructs. But, indeed, the problems you mention are not insignificant.

Reply via email to