Thread overview
Thoughts on Herb Sutter's Metaclasses?
Apr 10, 2018
Chris Katko
Apr 10, 2018
Chris Katko
Apr 10, 2018
Joakim
Apr 10, 2018
Chris Katko
Apr 10, 2018
12345swordy
Apr 10, 2018
jmh530
April 10, 2018
https://www.youtube.com/watch?v=6nsyX37nsRs

I'm really happy with the way languages are finally progressing. I've said for years that we should be able to program the "rules" (e.g. code guidelines) that programmers then abide by, so that they are statically checked.

DScanner is an example. But the core flaw is... it's "rules of thumb". That's great. But what about "rules for MY projects" or "rules for THIS SPECIFIC CODE TEAM."

I love D's templates. I'm doing stuff I never thought possible like accidentally re-inventing Pass-by-Name / "Named Parameters" completely at compile-time / zero run-time overhead.

https://en.wikipedia.org/wiki/Named_parameter

Anyhow, I wonder what the D community thinks about this kind of meta-programming, and how much D already can do without metaclasses, and whether D could possibly benefit from implementing them.

Thanks.
April 10, 2018
One more note: It seems like this would be heaven for trying out new language features without having to "manually" add them into the compiler first. By hijacking the syntax to AST stage, we can add new constructs with real-functioning code, and have others evaluate themselves and unit test them without having to "imagine" whether the code would actually work. It'd be on a real binary, using a real (unmodified!) compiler.

And you can also have your own "in-house" specializations. Which is no different than expecting people to use your API. Some API's have method chaining, and you use it. Some have pass-by-name, and you use it.


April 10, 2018
On Tuesday, 10 April 2018 at 01:21:07 UTC, Chris Katko wrote:
> One more note: It seems like this would be heaven for trying out new language features without having to "manually" add them into the compiler first. By hijacking the syntax to AST stage, we can add new constructs with real-functioning code, and have others evaluate themselves and unit test them without having to "imagine" whether the code would actually work. It'd be on a real binary, using a real (unmodified!) compiler.
>
> And you can also have your own "in-house" specializations. Which is no different than expecting people to use your API. Some API's have method chaining, and you use it. Some have pass-by-name, and you use it.

See previous forum thread on the topic, with Walter chiming in a bit too:

https://forum.dlang.org/thread/kglnxqbcugerhynngewp@forum.dlang.org
April 10, 2018
On Tuesday, 10 April 2018 at 05:55:06 UTC, Joakim wrote:
> On Tuesday, 10 April 2018 at 01:21:07 UTC, Chris Katko wrote:
>> [...]
>
> See previous forum thread on the topic, with Walter chiming in a bit too:
>
> https://forum.dlang.org/thread/kglnxqbcugerhynngewp@forum.dlang.org

Wow, that thread had very little discussion, and a huge amount of bickering over whether someone actually understood what someone else might have said.
April 10, 2018
On Tuesday, 10 April 2018 at 09:32:49 UTC, Chris Katko wrote:
> On Tuesday, 10 April 2018 at 05:55:06 UTC, Joakim wrote:
>> On Tuesday, 10 April 2018 at 01:21:07 UTC, Chris Katko wrote:
>>> [...]
>>
>> See previous forum thread on the topic, with Walter chiming in a bit too:
>>
>> https://forum.dlang.org/thread/kglnxqbcugerhynngewp@forum.dlang.org
>
> Wow, that thread had very little discussion, and a huge amount of bickering over whether someone actually understood what someone else might have said.

...I'm sorry?
April 10, 2018
On Tuesday, 10 April 2018 at 09:32:49 UTC, Chris Katko wrote:
>
> Wow, that thread had very little discussion, and a huge amount of bickering over whether someone actually understood what someone else might have said.

My take-away was that it can be done in D, but would be simpler with AST macros and Walter is against AST macros.