Discussion on static reflection syntax in C++

SealabJaster sealabjaster at gmail.com
Mon Feb 22 18:01:34 UTC 2021


On Monday, 22 February 2021 at 16:27:49 UTC, Andrei Alexandrescu 
wrote:
> Of possible interest:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2320r0.pdf

"Readability. Obviously, we’d like our programs to be readable. 
We want syntax that is both visually distinctive yet 
comprehensible."

Can anyone more experienced with C++ confirm that this is in any 
way readable and easy to understand? Because my definition of 
"readability" appears to be vastly different, especially when I 
imagine it being used alongside the rest of C++'s symbol spam.

"f<([:Refl:])>();"

wat

"(: R :). Looks like smiley faces"

But apparently "[:" and ":]" don't. Part of me feels like the 
designer(s) really wanted to use square brackets for that extra 
*artistic touch*.

I don't really have anything constructive to say about this 
(presumably) draft proposal, because the actual feature itself is 
of course pretty useful, and I'm not really qualified to say 
whether this proposal is a good fit or not. But why is it that 
C++ uses such unusual syntax for everything?


More information about the Digitalmars-d mailing list