3 ms·
So how would you like to represent a vtable in Swift today? I mean down to the specific compiler implementation details. In GCC, Clang, MSVC they all both have
by stevefan1999 3y ago
So how would you like to represent a vtable in Swift today? I mean down to the specific compiler implementation details. In GCC, Clang, MSVC they all both have different behaviors with different situations, such as virtual destructors, multiple inheritance and POD paddings.
Another problem is C++ template. Oh boy that thing is semi-decidable on its own.
Besides that, you have small things like ADL [1] and SFINAE plus the new C++ concepts...
That's why after learning C++17, I decided to give up and switch to Rust.
I'm not sure why is everybody so after C++. I don't care about sunk cost, and I just want the best of the best. Easy to implement the parser, easily make a compiler for it. I like those languages.
[1]: https://en.wikipedia.org/wiki/Argument-dependent_name_lookup https://en.wikipedia.org/wiki/Argument-dependent_name_lookup
- zer0zzz 3y agoSwift handles virtual functions through thunks
- FpUser 3y ago>"Easy to implement the parser, easily make a compiler for it." That is somebody else's headache, namely compiler developers. As a user I am totally happy with C++. It lets me do what I want to do without much fuzz and has enough features to be ergonomic. Sure I would never know it completely but who says I need it? It absolutely does not preclude me from being productive.
- Someone 3y ago> I'm not sure why is everybody so after C++ Not everybody; those who have tons and tons of existing C/C++ code, want to move away from it, and realize the only way to do that is gradually. Swift’s C++ interop makes it possible to add a Swift class to an existing C++ code base and have code from either language call into the other, mostly without having to copy or convert function arguments. You can write Swift functions that work with C++ std::string today, for example, gradually replace all code using it by Swift code, and then change the type of the value to Swift’s string. Easy? No, but easier than a ‘big bang’ rewrite.