25 ms·
Besides the "pragmatist in pain" route to mainstream there's also the "benefits for free" route. C++20 is a very different language than C, but it got to mains
by bryanlarsen 3y ago
Besides the "pragmatist in pain" route to mainstream there's also the "benefits for free" route.
C++20 is a very different language than C, but it got to mainstream because at the beginning it was "C with classes". Typescript is similar.
Every company has a bunch of "early adopter" engineers. The easiest way for them to introduce something new at their company is by claiming that the transition will be seamless and free.
D partially tries this path with its C compatibility. But it's a rare C codebase that doesn't use function pointers or array pointer syntax. I don't think D had any choice but to abandon those, but it made this path a lot harder.
P.S. there's a third route: piggyback along with a market transition. That's how Java & Javascript & Perl went mainstream.
- WalterBright 3y agoD supports function pointers and array pointers, and always has.
- bryanlarsen 3y agoBut not in a C-compatible way, right? IIRC, you can't just take a good size C file, put a tiny bit of D in it and compile it with the D compiler, can you? Happy to be corrected.
- destructionator 3y agoTranslating small syntax differences like that are easy to do by machine if you have to.
- WalterBright 3y agoYes, it's semantically C-compatible. They're close enough that converting C code to D code manually is straightforward. But it isn't necessary to do that, you can simply import C code into D code: // D code import mycstuff; // loads mycstuff.c int main() { int* p = mycfunction(); // call C function return *(p + 1); // pointer arithmetic }