2 ms·
I know enough C++ to understand that "member access operator" example, but not enough to have ever seen that before, and my first thought is just "big yikes".
by rvense 2y ago
I know enough C++ to understand that "member access operator" example, but not enough to have ever seen that before, and my first thought is just "big yikes".
I'm sure there are cases where this will mean you can write more general and flexible library code, but is it really worth the cost? C++ just seems so full of this three-starred nonsense.
- Mond_ 2y agoShould a modern language support member access operators? Probably not, honestly. Is it really impressive that Carbon found an abstraction to support it that neatly fits into a Rust-like trait system and generalizes all sorts of things? Yes.
- rvense 2y agoNow, that I won't argue with at all! There are some big-brained people that will find ways forward for various users of C++: some will migrate, some will create impressive tooling, and some, likely will evolve the language as it is - in the grand scheme of things, C++98 becoming an ambiguous term isn't too far off. These are all economic necessities based on just how much C++ has been deposited in the world over the past 35 years. But I also can't help but feel like maybe the big-brainedness required for all this machinery around the language is of sort of the same stock that created the complexity which made the machinery necessary in the first place? Is this a cultural issue? Is the biggest problem in computer science actually that we have too many smart people?
- drysine 2y agoDon't you think that it is much much simpler than, for example, any of the meta-programming stuff in Python?
- sour-taste 2y agoIt's quite handy in interpreters: read the instruction, store a pointer to the referenced field, then operate on it. That's the only time I used it at least.
- spacechild1 2y agoAltough taking pointers to member functions is much more common, pointers to member variables certainly have their use cases. Here's on example: binding C++ member variables to a scripting language. // read and write variable player_type["speed"] = &player::speed; https://sol2.readthedocs.io/en/latest/tutorial/cxx-in-lua.html https://sol2.readthedocs.io/en/latest/tutorial/cxx-in-lua.ht...