5 ms·
Why doesn’t he rewrite it in rust then and do himself a favor going forward?
by tbrock 6y ago
Why doesn’t he rewrite it in rust then and do himself a favor going forward?
- detaro 6y agoWhy do you think he's adding Rust components to it?
- tbrock 6y agoSeems like re-writing it with extra steps.
- ludamad 6y agoIt's "re-writing" with actual steps
- justsomeuser 6y agoI think he is being paid to, not sure if he would choose to personally. There was a blog post a while back where he more or less said "I am being paid to add Rust".
- duckerude 6y agocurl is very widely used, including on platforms that Rust doesn't support. Broad support is perhaps its killer feature. A rewrite would introduce new bugs, even if they aren't memory issues. The rewrite could end up buggier than the original.
- tbrock 6y agoYeah of course, I just think instead of all this “it could be in rust talk” let’s just get it over with.
- acdha 6y agoAs an example of how widely curl is used, the author has posted things like the support emails he gets from people whose car or IoT device uses curl: https://daniel.haxx.se/blog/2016/11/14/i-have-toyota-corola/ https://daniel.haxx.se/blog/2016/11/14/i-have-toyota-corola/ I love using Rust for new development but curl is _everywhere_ and a port would need to spend a lot of time copying old quirks. Given how clunky C APIs are, I’d think it’d be better to migrate more of the callers to a higher-level interface anyway.
- mamcx 6y agoSo is making the UNSAFE FOR ALL, instead of unsafe for few? Defaults matter. P.D: Think if web browser were not fixed or improved because maybe somebody is using Win95. Its the same. The path to better is stop using what is proven to be bad (C/C++ is proven to be very bad!). The path to make sure niche platforms are covered is turn what is better in something more popular until it replace the old... and niche platforms use it... This is called progress. Is how its done.
- OneWingedShark 6y ago> A rewrite would introduce new bugs, even if they aren't memory issues. OTOH, a rewrite could be useful in splitting up the problem-space as well as reducing errors. This is where Ada excels, and one nice way of splitting the problem-space could be in providing types (perhaps with provable properties via SPARK) that properly decompose the problem-space. -- Small, quick/dirty "back-of-napkin" design. Package Uniform_Resource_Locator is Type Protocol is (HTTP, HTTPS, FTP, SFTP, ETC ); Type URL is private; Function Get_Protocol(Object : URL) return Protocol; -- other operations. Function Parse(Text : String) return URL; -- Text to URL. Function "+"(Object : URL) return String; -- URL to Text. Private Type URL is record --... end record; End Uniform_Resource_Locator; > The rewrite could end up buggier than the original. Given the properties of a language like Ada, you could decompose the problem-space into types (like above) and leverage the language properties to ensure the correctness of the program. For example, Ada mandates full-coverage on cases can so when you say `case Get_Protocol(The_URL) is ...` you have to provide for every value in the enumeration (Protocol here), and the compiler enforces this. So, every place you have a case-statement operating on a Protocol value, absent the `others` option, the compiler will error-out and point you to the location you're missing a value. ...meaning that you can update the Protocol enumeration and have the compiler complain at every location you need to fix/implement the new protocol.
- jayp1418 6y agoThis might interest you https://github.com/1ma/CurlAda https://github.com/1ma/CurlAda
- otabdeveloper4 6y agoThere are much easier ways to get array bounds checking than rewriting everything in Rust.
- deleted 6y ago[deleted]
- domenukk 6y agoAnd that solves double frees through ___?
- tedmielczarek 6y agoHaving worked with him at Mozilla I can assure you that he is familiar with Rust. I'm as much of a Rust fanboy as anyone, but "rewrite it in Rust" is not a simple process, and there are many tradeoffs involved. That being said, I think Rust will continue to improve on this front. Things like the GCC Rust frontend work are promising avenues to expand Rust's reach in terms of supported platforms, and tooling like c2rust will make rewrites simpler. There are also techniques like `RLBox` now that allow compiling C code to WebAssembly and running it in a sandbox which offer mitigation strategies without a full rewrite.