[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1762208477789.png (233 KB, 866x650)
233 KB
233 KB PNG
There are many languages, but only one is an INDUSTRIAL STRENGTH language.
>>
File: 1744406944120898.png (53 KB, 910x1024)
53 KB
53 KB PNG
>>107096329
>>
because it was designed standards first like languages used to be now nobody even writes a spec except performatively
>>
>>107096329
when is we getting reflection?
i remember people being hyped up in c++11, the hype came back for c++20, and it seems to be at an all time high for c++26
https://isocpp.org/files/papers/P2996R4.html
>>
>>107096577
use case for reflection?
>>
>>107096820
The ability to seamlessly integrate with a scripting language in 99% of cases without any effort at all
>>
>>107096832
that doesn't seem very appealing
>>
>>107096820
>automatically generate serializers/deserializers
>automatically generate packet version of your structs (with padding removed, per-type basis handling of endienass, etc..)
>automatically print a struct with all of it's fields
>transpose types when inside an array, to make accessing the same fields over multiple indices better in terms of cache locality
>>
>>107096832
t. has never written bindings before

wrapping libraries requires careful consideration of vendor specific idioms of ownership, what parameter tags mean, and so on with a fuck ton of different nuisances that always end up requiring manual tard wrangling. youre never going to be able to simply reflect an entire object by its type name and a bunch of methods.

whats even worse for your argument is that we could already do that already with templates, baring arg names nobody would want to link into their ship builds anyway. the poster child of reflection, java, doesn't even have named args in their signatures either; and nobody ever argues javas reflection hackery doesn't go far enough.

>>107096984
>>automatically generate serializers/deserializers
>>automatically generate packet version of your structs (with padding removed, per-type basis handling of endienass, etc..)
"what are pointers to members"

>>107096984
>>automatically print a struct with all of it's fields
solved in C++17 with structural bindings and can even be backported much further with hacks. case in point, boost hana

>>107096984
>>transpose types when inside an array, to make accessing the same fields over multiple indices better in terms of cache locality
you're an idiot
>>
>>107097130
>youre never going to be able to simply reflect an entire object by its type name and a bunch of methods.
nominal type tards say the cutest shit, like yeah you're right, i'm not going to be reflecting on an "object" by its type name. why the fuck would i do that?
>whats even worse for your argument is that we could already do that already with templates
No you cannot.
>the poster child of reflection, java
lisp.
>>
>>107097165
stop being a retarded nigger bitching over verbiage that in context makes complete sense. "b-but you said objec". to reiterate, there is nothing reflection helps with in terms of reflecting any given typename/alias/whatever and an array of methods to bind between language boundaries.

>>107097165
>lisp.
ah, you're just a moron who thinks in terms "hahaha cobolt boomer bank language. lisp numba wan. pearl code generators very good" because of repeated nudev spam from 20 years ago being endless repeated. have fun with your totally real lisp to sysv/msftabi generators
>>
>>107096329
Almost every modern computer language is just applied C#
C# is literally just applied C++
C++ is just applied C
C is just applied assembly.
>>
>>107097228
ps:
>>hurrdurr "No you cannot."
>Filtered by templates
>Filtered by language binding 101
>Cant so much as write a C++11 function traits helper
>Thinks reflection is going to save the day.

poetry. this sounds about right from the tards spamming "C++ reflection in 2 weeks"
>>
>>107097130
try using pointers to member when you serialize a struct, only for the server/client to use a different padding/endianess.
>>
>>107097130
structural bindings only work if your type is, well, structural.

if you have custom constructors for your type, then you can't use ad-hoc structured bindings.
instead you have to specialize std::get, std::tuple_size and std::tuple_element for your class/struct, which adds tons of boilerplate.

printing types via reflection would also work recursively, without needing to write any more code to make it work.
>>
>>107097324
>filtered by endianness
>copy/pastes my language of "pointers to member" (could've phrased it different or made it plural)
>should know im not referring to memcpy of a trivial type
>still thinks endianess is still a problem

As I said, this is about on par for what you can expect from the retards spamming "C++ reflection in 2 weeks". This is embarrassing.

>>107097355
>if you have custom constructors for your type, then you can't use ad-hoc structured bindings.
As if people writing bindings and specniggers wouldn't immediately say "if you've got a custom constructor your <bling bloop reflector instance accessor 200> is automatically deleted". For serializing structs, it's fine. For serializing data types in common C headers, it cannot be an issue. If you need more, you can just use a ptm fallback. This then proves my main point, you're an idiot if you think reflection is going to magically solve all the manual tard wrangling required for binding and serialization generation.
>>
>>107097355
>instead you have to specialize std::get, std::tuple_size and std::tuple_element for your class/struct, which adds tons of boilerplate.
>printing types via reflection would also work recursively, without needing to write any more code to make it work.
also i zoned out here. dunno what nigger babble you're waffling on about here. you don't need to overload anything. next time you can just say you got filtered by SFINAE. maybe i'd be nicer on your retardation if you didn't just read past "case in point, boost hana" to invent nonexistent problems to an issue already solved in a handful of ways.
>>
>>107097439
>in a handful of [different*] ways
emphasis on different. you can roll an any type and use it with an is constructible like tester, you can use c++23 if constexpr (...) tests, you can use the hana hacks, you can also the other hana solution for C++14 based targets.

who exactly told you to start defining std::get, tuple_element, and such overloads? what part of you can abuse structural bindings for most common cases made you think, "right, obviously this anon means i gotta start writing a fuck ton of tuple overloads"?
>>
File: 1738420004553368.jpg (523 KB, 987x741)
523 KB
523 KB JPG
>>107096329
>>
>>107097130
>wrapping libraries requires careful consideration of vendor specific idioms of ownership
Not when there is a garbage collector which there always is in scripting languages. Retard
>>
>>107097500
>the presence of a garbage collector means ownership semantics magically sort themselves out between language bindings
>hurrdurr u r retard
mhm, sure thing kiddo
>>
File: ref.png (87 KB, 806x316)
87 KB
87 KB PNG
>>107097439
>>
>>107097515
>the presence of a garbage collector means ownership semantics magically sort themselves out
Yes.
>>
>>107097500
try passing a std::shared_ptr to lua or guile and see where that gets you
>>
>>107097517
You're still just a retarded nigger.
>filtered by structural bindings
>filtered by constructors
>thinks posting tuple-like requirements proves his argument
https://godbolt.org/z/sYr9soMWr
inb4 "REEE THIS ISNT POSSIBLE. WHERES MY STD::GET<1> OVERLOAD!!! THERES A CONSTRUCTOR THERE. NOO, YOU CANT JUST UNPACK A STRUCT LIKE THIS"
>>
>>107097555
remove the parameter in your constructor and it won't compile.
<source>:9:15: warning: empty parentheses interpreted as a function declaration [-Wvexing-parse]
Nigger you();
^~
<source>:9:15: note: remove parentheses to declare a variable
Nigger you();
^~
<source>:10:11: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
auto &[x, y, z] = you;
^~~~~~~~~
<source>:10:11: error: cannot decompose non-class, non-array type 'Nigger ()'

>filtered by cpp
>>
>>107097568
Kek, you actually did >inb4 "REEE THIS ISNT POSSIBLE. WHERES MY STD::GET<1> OVERLOAD!!! THERES A CONSTRUCTOR THERE. NOO, YOU CANT JUST UNPACK A STRUCT LIKE THIS"


>disables C++17
>surprised pikachu, a c++17 feature without a c++14 workaround stops working
>therefore i need C++26
>reeee
>give me reflection right now
>i demand reflection
>this is impossible without reflection

>hurrdurr structural bindings wont work with a constructor
>adds constructor
>it still works
>removes constructor
>wtf why cant i construct this type with these arguments
>>
>>107097534
Retard. Using reflection, you could automatically bind the lua __gc metamethod to a destructor of a class, any class.
>>
>>107097590
>>107097568
https://godbolt.org/z/rn6n59vdo

inb4 episode two of "REEE THIS ISNT POSSIBLE. WHERES MY STD::GET<1> OVERLOAD!!! THERES A CONSTRUCTOR THERE. NOO, YOU CANT JUST UNPACK A STRUCT LIKE THIS"
>>
>>107097593
if you use metamethods, you aren't passing actual data to lua. you're just passing an opaque handle with predefined methods/field getters and setters.
>>
>>107097630
That is what a class pointer is. How do you think gtk works? Everything is opaque there.
>>
>>107097228
> to reiterate, there is nothing reflection helps with in terms of reflecting any given typename/alias/whatever
why do you think reflection is related to an operation on the name of a type? this is why you don't understand reflection...

>>107097252
define a generic function which iterates over an arbitrary type's members, getting their offsets and sizes. it must not require any special handling of the type's declaration, no registration of members.
>>
>>107097610
<source>:12:11: warning: decomposition declarations are a C++17 extension [-Wc++17-extensions]
>>
Yes and it's called BigNiggerRapeBabiesBuckBroken++
>>
>>107096820
pretending that you have an equivalent to proc macros. while in reality, it's useless without type classes and a central ecosystem of packages. and it doesn't cover 5% of the use-cases proc macros cover anyway. and on top of that, no one is going to use anything newer than c++11 (or c++14) as the latest, with most projects written in the C with classes style, with ZERO "modern" features used.
the C++ committee has one purpose, and that is to continue to exist by adding never ending bloat to the language. it's not concerned with doing anything coherent to make the language actually better. not that the language is salvageable if they actually tried, mind.
>>
>>107096577
sorry they're busy rewriting printf for the fourth time, maybe in C++29 we'll get reflection (but it will not be complete and will be some runtime bullshit)
>>
>>107096329
I wasted so many years of my life on this bullshit back in the day. Should have just learned Java or something at the time.
>>
>>107096820
writing unmaintainable spaghetti code
>>
>>107100216
>and will be some runtime bullshit
and how exactly would you implement compile time reflection, genius? ever heard of the halting problem?
>>
>>107100244
I want reflection for going through members of a struct (class) at compile time.
So I'll need a function to check if a type has members (std::is_struct or something), and then a way to get the number of members, then a way to get each member.
Would be a huge bonus if I could get the member name at compile time too, but not strictly necessary. But would be really nice.
There are so many ways to do it, but something like std::num_members<T>::value and std::get<index>(T& value) would work for me.
>>
>>107100366
You can do all that using
std::meta::nonstatic_data_members_of
and
std::meta::identifier_of
The first one returns a std::vector of meta types, and the second a std::string_view
See:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r13.html#a-universal-formatter
for usage
>>
File: IMG_4597.png (332 KB, 575x726)
332 KB
332 KB PNG
>NOOO YOU SHOULD USE std::peepee INSTEAD OF std::poopoo BECAUSE I SAID SO
>N.B. std::peepee and std::poopoo do the exact same thing
There, I summarized every C++ thread.
>>
>>107096329
>battle-tested
>industrial strength
>military-level encryption
we should create a dictionary of tech illiterate lingo. ^ is my kickstart contribution.
>>
>>107100549
> anally obliterated
>>
>>107100528
C++ is the most anti reddit language
>>
>>107096329
ftfy.
>>
>>107100244
runtime reflection is not planned at all. it would require your binary to link with something like llvm of libgcc. Also many compilation flags would conflict with runtime introspection, starting with -fvisibility=hidden and pretty much any aggressive inlining flags.

>>107100487
reflection was voted and got accepted in the Sofia ISO meeting.
Herb Sutter lists all 6 papers that made it, and it's only compile-time introspection.
https://herbsutter.com/2025/06/21/trip-report-june-2025-iso-c-standards-meeting-sofia-bulgaria/
The syntax is much clearer than previous attempts. They've finally stopped using std::integral_constant for everything, instead preferring the use of consteval/constexpr

The first paper is really huge:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2996r13.html



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.