On Wednesday, 16 January 2019 at 05:32:51 UTC, Walter Bright wrote:
On 1/15/2019 10:39 AM, Jacob Carlborg wrote:
Perhaps we shouldn't support user defined types or functions either ;)

You deliberately wrote that, and I'm confident you'd never try to pass that off as good work.

With macros, however, programmers are convinced they are creating models of clarity. I've seen programmers truly believe:

    #define BEGIN {
    #define END }

improves their C code. Fortunately, that was ridiculed out of existence in the 1980s, but the more subtle abuses persist with their ardent defenders. I used to use a lot of macros in my C code, and a few years back made an effort to remove them all from the dmd source code. The result was very satisfactory.

I've seen entire code bases abandoned because of macros after the original developer left.

I'm pretty sure Jacob is talking about a completely different type of macro (i.e. not textual substitution), AST macros. I'd be interested to see how close we could get if we allowed mixin template to contain expression as well as declarations (obviously these could only be instantiated in function contexts). Anyway something to play around with at DConf.

Reply via email to