The name "Corrode" doesn't seem very positive given the purpose of this program...
Corrode: C to Rust translator written in Haskell
71–80 of 127 posts
Re: Corrode: C to Rust translator written in Haskell
#72Re: Corrode: C to Rust translator written in Haskell
#73Absolutely blown away by the detail of the documentation. The main logic of this project is in a literate haskell file you can easily read on GitHub. https://github.com/jameysharp/corrode/blob/master/src/Langua... I wonder how readable is to someone who isn't experienced in Haskell. To me reads like a breeze, but I have a project using the exact same parsing library so maybe that puts me at an advantage. The language…
By "some stupid thing to their headers" are you referring to nullability annotations? I'm not sure what else Apple would have added to pure C headers (as opposed to obj-c) any time in the past few years.
Re: Corrode: C to Rust translator written in Haskell
#74Best examples: rake (and everything in the ruby ecosystem basically), the amount of people touching ruby c code is very small compared to all the 'standard tools', or cargo.
Re: Corrode: C to Rust translator written in Haskell
#75Re: Corrode: C to Rust translator written in Haskell
#76I do get that Haskell is useful to be taken as a tool for these kind of code transformations (at least I have seen quite a few of those) but I am always a bit surprised that people would start such a project in a language that has -per se- nothing to do with either the source or the target language. I know, I know, it doesn't always have to be this way, but I am very much of the opinion that everytime good tools in a…
Re: Corrode: C to Rust translator written in Haskell
#77Absolutely blown away by the detail of the documentation. The main logic of this project is in a literate haskell file you can easily read on GitHub. https://github.com/jameysharp/corrode/blob/master/src/Langua... I wonder how readable is to someone who isn't experienced in Haskell. To me reads like a breeze, but I have a project using the exact same parsing library so maybe that puts me at an advantage. The language…
He lays it out fairly well for people to help out.
Re: Corrode: C to Rust translator written in Haskell
#78Earlier quoted context omitted.
Here you go. It didn't like my stdio.h. Apparently enums and unions aren't supported, but: extern int printf(char *, ...); int main(int argc, char argv[]) { printf("Hello, world!\n"); return 0; } Was turned into: extern { fn printf(arg1 : *mut u8, ...) -> i32; } #[no_mangle] pub unsafe fn main(mut argc : i32, mut argv : *mut u8) -> i32 { printf(b"Hello, world!\n\0".as_ptr() as (*mut u8)); 0i32 } edit: Also worth noti…
Shouldn't a C `int` be converted to Rust's `isize`. I think that captures the spirit better.
Re: Corrode: C to Rust translator written in Haskell
#79Earlier quoted context omitted.
On the rust subreddit someone tongue-in-cheek suggested `cargo clippy | rustfix` to be used in conjunction with this tool for better rust code. But that actually could work! Clippy has a ton of lints that make your code more idiomatic, and rustfix basically takes diagnostic output and applies suggestions (still WIP). Clippy is geared towards making human-written unidiomatic code better, so it might not catch some sil…
I haven't used nightly much, what all does Clippy do?
Re: Corrode: C to Rust translator written in Haskell
#80This is probably the most "Hacker News" thing I've ever seen.