Absolutely 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…
Corrode: C to Rust translator written in Haskell
121–127 of 127 posts
Re: Corrode: C to Rust translator written in Haskell
#122Earlier quoted context omitted.
How so? For me, "rust" conjures images of a rusty nail, rust getting in your tap water, a machine in disrepair from rust, and becoming "rusty" at some skill. And I don't think I'm alone.
And Python conjures images of dangerous snakes (and people getting killed by them), Go conjures images of that argument with my SO, when she told me "go!", C# conjures images of sharp objects like knives, and PHP conjures images of programming in PHP. It's just a name, nobody really cares about rusty nails and rust in tap water when discussing Rust the programming language. And by nobody I mean nobody in the statisti…
You're right that no language's name is perfect and immune from bikeshedding; however, the psychophysical mechanism of disgust works at a far deeper, extra-rational level than other negative traits. "Rust" evokes it, pythons don't.
Re: Corrode: C to Rust translator written in Haskell
#123Earlier quoted context omitted.
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.
It was possibly even a Apple added their blocks extension to C and Obj-C, I remember this verifying some issues for Haskell tool which parsed C.
Re: Corrode: C to Rust translator written in Haskell
#124This is the coolest thing I've seen on HN in a long time, and useful to boot. Hopefully this will be a very big help to people moving over to Rust from C for its safety and type-checking. In general I don't support rewrites because, as many experienced programmers have pointed out, rewrites often make many of the same mistakes as the program they're rewriting. But transpilation allows us to keep the code with all the…
I'm curious why you have an issue with the mostly-MIT licensed main Rust compiler. Could you explain?
I have no problem with MIT for smaller tools, but the compiler is too foundational a dependency to take risks on, and it needs better protections--protections which are afforded by the GPL and the FSF's funding of GNU projects.
Re: Corrode: C to Rust translator written in Haskell
#125This is probably the most "Hacker News" thing I've ever seen.
We won't reach peak HN until somebody writes an ARC to Node.js transpiler in Haskell.
Re: Corrode: C to Rust translator written in Haskell
#126Earlier quoted context omitted.
Literate programming is more than that. It is encouraged to order things such that they make sense to the reader, not to the compiler. You can give names to chunks of code and later glue them all together in a different order. My tool of choice for this is Emacs org-mode with noweb support. The source file is "tangled" (i.e. individual chunks of code are glued back together in a specified order) to create the source…
There's little need to reorder Haskell code because you can define things in any order. The literate programming tangle process mainly exists to remove Pascal's order restrictions.
It can be nice to have a single document explaining the whole project, producing individual source files upon tangling. For this approach you need control over order and target files. "Literate Haskell" is hardly more than a reversal of the meaning of comments and code.
Re: Corrode: C to Rust translator written in Haskell
#127Earlier quoted context omitted.
Not to look a gift horse in the mouth, but it seems like Corrode misses some other chances to use idiomatic Rust: 1. Rust fn:main doesn't need to return something. 2. The arguments to main aren't mutated, so Rust doesn't need to declare them as mutable. 3. Ditto for the argument to printf. Anyone know how easy it is to recognize and code for such cases in the transpiler? Edit: It looks like they might have opposite d…
1. A special case could be added for `main`, but it's no big deal. 2. This seems difficult as the C arguments were mutable; the algorithm would have to start doing analysis rather than direct translation. 3. Quite difficult to "know" that this printf doesn't write to its arguments, especially since the printf is manually declared.