Ah yes, we've come full "circle" and C++ has tacked on D's metaprogramming and CTFE abilities.
Circle: C++ Automation Language
11–20 of 27 posts
Re: Circle: C++ Automation Language
#12Re: Circle: C++ Automation Language
#13This seems useful for code generation. Cannot relate this to any previous problems I encountered using c++ Any other interesting use of this?
Seems that it could be used to solve an old-time classic: generate a mapping from an enum value to its string representation. Another use case that comes to my mind is maybe automating test case generation. Occasionally I was running into situations where I thought code generation could be useful, but not sure what could be a "killer app" equivalent for this feature. Related topic: standardizing reflection in c++. ht…
Circle has dozens of special traits for accessing useful stuff about types, packs, etc. Don't need to overengineer such a simple thing.
Re: Circle: C++ Automation Language
#14Re: Circle: C++ Automation Language
#15This seems useful for code generation. Cannot relate this to any previous problems I encountered using c++ Any other interesting use of this?
https://github.com/seanbaxter/shaders#reflection-and-attribu...
Just mark your declarations up with custom attributes:
[[.imgui::range_float { .1, 5 }]] float Zoom = 1.5;
[[.imgui::range_float { 0, 1 }]] float Speed = .15;
[[.imgui::range_float { .1, 1 }]] float XScale = .3;
[[.imgui::range_float { 0, .5 }]] float YScale = .2;
Then loop over the members with a meta for, and emit widget code that's guided by the attribute kind and data. These attributes each define a scrollbar.The kind of data you reflect over will likely come from within the program.
Re: Circle: C++ Automation Language
#16This project feels similar in spirit to Zig, which has robust compile time evaluation and reflection. The cool part about Zig is that it uses this ability (via the `comptime` keyword) to power it’s generic system, and not vice versa (looking at you, Turing complete type systems) https://ziglang.org/learn/overview/#generic-data-structures-...
At least they give it a nice abbreviation like “comptime” instead of the atrocious “CTFE” that C++ seems to like.
Re: Circle: C++ Automation Language
#17This seems useful for code generation. Cannot relate this to any previous problems I encountered using c++ Any other interesting use of this?
Re: Circle: C++ Automation Language
#18This seems useful for code generation. Cannot relate this to any previous problems I encountered using c++ Any other interesting use of this?
Seems that it could be used to solve an old-time classic: generate a mapping from an enum value to its string representation. Another use case that comes to my mind is maybe automating test case generation. Occasionally I was running into situations where I thought code generation could be useful, but not sure what could be a "killer app" equivalent for this feature. Related topic: standardizing reflection in c++. ht…
the trick (relyiong __FUNCTION__ like macros/(funcs?)) is here - https://github.com/Neargye/magic_enum/blob/master/include/ma...
and https://github.com/Neargye/magic_enum/blob/master/include/ma...
Re: Circle: C++ Automation Language
#19This seems useful for code generation. Cannot relate this to any previous problems I encountered using c++ Any other interesting use of this?
My favorite use is putting user-defined attributes on data members, and using reflection to generate a UI to manipulate those values. I do it with these shadertoys: https://github.com/seanbaxter/shaders#reflection-and-attribu... Just mark your declarations up with custom attributes: [[.imgui::range_float { .1, 5 }]] float Zoom = 1.5; [[.imgui::range_float { 0, 1 }]] float Speed = .15; [[.imgui::range_float { .1, 1 }]…
Lately I've been working on a Go (pretty small subset -- no GC or concurrency) to C++ compiler and generating meta stuff as part of it. Mostly because I like how focused Go's syntax is and also it having an official parser and type checker in the standard library makes things pretty quick to get started.
I should play with Circle some time! It's definitely touching on a lot of the desired things from a metaprogramming layer.
Re: Circle: C++ Automation Language
#20It might seem too picky to some, but I need to have good control over the inputs into my build processes. There are the obvious concerns regarding reproducibility and security which, again, maybe some don't care about. But there are also implications for distributed building and caching workflows. Circle doesn't practically drop in for C++ while it is allowed to do arbitrary I/O (even off the machine!) at build time.
It seems like it should be a solvable problem at the expense of restricting what can happen at compile time, at least as an opt-in feature.
The usual response is "well, don't do that kind of thing!", but at scale, manually maintaining that kind of design standard isn't practical. But I'm sure you all audit all the source that feeds into each one of your container base images.