5 ms·
Quite honestly, I love what MS has done with JavsScript with Typescript. It would be great if they could do the same for C. I guess the hard part will be the
by timmg 4y ago
Quite honestly, I love what MS has done with JavsScript with Typescript. It would be great if they could do the same for C.
I guess the hard part will be the fact that all your dependent libraries will (likely) still be unsafe.
- pjmlp 4y agoSee also https://devblogs.microsoft.com/cppblog/high-confidence-lifetime-checks-in-visual-studio-version-17-5-preview-2/ https://devblogs.microsoft.com/cppblog/high-confidence-lifet...
- flohofwoe 4y agoI'm a bit confused, at the start they talk about C++, but some of the code examples look like C. Do those checks also work in the C compiler? (the difference is kinda important, because unlike Clang, the MSVC C++ compiler doesn't have enough non-standard language extensions to compile C code that was written in the last 20 years).
- pjmlp 4y agoThey talk about C++, because that is what mostly matters to Visual C++ customers, however /analyse mode also works in C code. https://learn.microsoft.com/en-us/cpp/code-quality/code-analysis-for-c-cpp-overview?view=msvc-170 https://learn.microsoft.com/en-us/cpp/code-quality/code-anal...
- sendfoods 4y agoI'm a bit confused. Didn't Herb Sutter essentially fork clang and extended the codebase in the beginning? Is microsoft working with that fork and (most importantly) re-contributing?
- pjmlp 4y agoIf you mean cpp2, that has nothing to do with Microsoft, it's Herb's personal project.
- sendfoods 4y agoNo, his lifetime work, e.g. https://herbsutter.com/2018/09/20/lifetime-profile-v1-0-posted/ https://herbsutter.com/2018/09/20/lifetime-profile-v1-0-post...
- pjmlp 4y agoNo that was a proof of concept for a paper that went nowhere. VC++ analysis builds up on SAL infrastructure. https://learn.microsoft.com/en-us/cpp/code-quality/understanding-sal?view=msvc-170 https://learn.microsoft.com/en-us/cpp/code-quality/understan... "Closing the Gap between Rust and C++ Using Principles of Static Analysis - CppCon 2020" https://www.youtube.com/watch?v=_pQGRr4P16w https://www.youtube.com/watch?v=_pQGRr4P16w There is also a clang work on lifetimes, but little progress has happened since 2019. "Lifetime analysis for everyone - CppCon 2019" https://www.youtube.com/watch?v=d67kfSnhbpA https://www.youtube.com/watch?v=d67kfSnhbpA
- sendfoods 4y agoSAL, as I understand it, is Visual Studio/Microsoft only? Do you have any idea if this work will make it to clang/gcc/g++?
- int_19h 4y agoSAL is deliberately designed such that it can be defined as a bunch of macros that expand to whatever compiler-specific magic the implementation needs (e.g. MSYS64 doesn't support it at all, but they define all those macros as no-op, so code still compiles). So in principle it could work across implementations.
- phailhaus 4y agoI'm begging them to do the same for Python.
- corndoge 4y agoThey made pyright which is pretty rad
- phailhaus 4y agoYeah it's pretty great, but still hamstrung by the inherent limitations of the language itself. Would love to see a new language on top of Python that treats types as first-class constructs.
- still_grokking 4y agoWhy "on top of Python"? The runtime is slow as hell, limited and actually very aged. But there are better modern alternatives. https://docs.scala-lang.org/scala3/book/scala-for-python-devs.html https://docs.scala-lang.org/scala3/book/scala-for-python-dev... Types in Scala are not only "first-class". You can even program with them like in TS. https://blog.rockthejvm.com/type-level-programming-scala-3/ https://blog.rockthejvm.com/type-level-programming-scala-3/ (Type level functions are correctness proves, BTW.) Enjoy!
- still_grokking 4y agoI guess I should have mentioned that Scala 3, with its new syntax, look almost like "Python with types". That's why I've mentioned it.