2 ms·
I feel like you could make a near-C++ that could really get traction. Literally compile to C++ (and then compile from there) and just fix a ton of cruft in the
by jimbob45 6y ago
I feel like you could make a near-C++ that could really get traction. Literally compile to C++ (and then compile from there) and just fix a ton of cruft in the language including:
- Stealing C# attribute notation instead of having the ridiculous __stdcall sort of convention
- Making a real fucking keyword for pure virtual functions instead of = 0
- A real keyword for include guards
- Function pointer syntax sugar
I now realize I'm describing D but D went too far. I just want like three nice changes that still allow near unchanged compilation to C++.
- tambre 6y ago>- Stealing C# attribute notation instead of having the ridiculous __stdcall sort of convention C++17 introduced the attributes in the form of [[attribute]], e.g. [[maybe_unused]], [[fallthrough]]. Clang also supports e.g. [[gnu::packed]] instead of __attribute__((packed)). >- A real keyword for include guards "#pragma once" is de facto supported everywhere. The general stance seems to have been to not bother with standardizing, as modules were a better solution anyway. >- Function pointer syntax sugar Aliasing function pointer seems mostly reasonable? using my_function_pointer = double(*)(int a, int b);
- p0nce 6y agoI think you overestimate how much traction such small modifications would get.
- MaxBarraclough 6y agoAs others have said, it's not worth breaking away from the standard language only to make a few shallow changes. It needs to be a fairly radical improvement or it's just not worth it. If Kotlin were too similar to Java, it couldn't have offered much reason to adopt it. If you want a modern language that compiles down to C (not C++), there's Vala. It even has some kind of async support now.