News for hackers. Stuff that matters.
Re:Why you should, actually, rewrite some of it in Rust by kreetx on Wednesday July 12, 2017 @11:44AM (#14753481)
Or even better, Haskell!
Re:Why you should, actually, rewrite some of it in Rust by skybrian on Wednesday July 12, 2017 @11:48AM (#14753508)
If you rewrote only part of a large C++ project in Haskell, is there a way to link it back in again?
Re:Why you should, actually, rewrite some of it in Rust by kreetx on Wednesday July 12, 2017 @12:06PM (#14753687)
It definitely can, but if you're asking for an out-of-the box support, then it's probably not as easy to use as Rust. Then again, if you plan to rewrite your code base, then why not invest -- typed IO is a big thing.
Re:Why you should, actually, rewrite some of it in Rust by aeorgnoieang on Wednesday July 12, 2017 @11:55AM (#14753576)
Call Haskell from C (not C++) seems pretty easy:

- [Calling Haskell from C - HaskellWiki](https://wiki.haskell.org/Calling_Haskell_from_C)

And the FAQ on the Haskell wiki directly addresses this too:

- https://wiki.haskell.org/Introduction#I_already_have_a_large....

So apparently it is doable!

Re:Why you should, actually, rewrite some of it in Rust by antientropic on Wednesday July 12, 2017 @12:05PM (#14753679)
It pulls in a huge runtime system, though (including stuff like garbage collection). This makes it much heavier than calling some Rust code.
Re:Why you should, actually, rewrite some of it in Rust by marcosdumay on Wednesday July 12, 2017 @02:20PM (#14755081)
True, where "huge" means something around 10MB.

For many projects that is a showstopper.

Re:Why you should, actually, rewrite some of it in Rust by mrkgnao on Wednesday July 12, 2017 @12:02PM (#14753646)
HN supports a funky subset of Markdown. :(
Re:Why you should, actually, rewrite some of it in Rust by concede_pluto on Wednesday July 12, 2017 @01:11PM (#14754325)
Only paragraphs, code literals, italics, and URLs.

https://news.ycombinator.com/formatdoc

Re:Why you should, actually, rewrite some of it in Rust by mrkgnao on Wednesday July 12, 2017 @11:56AM (#14753588)
The URL is slightly misleading: yes, you can call Haskell from C++.

https://stackoverflow.com/questions/3859340/calling-haskell-...

Re:Why you should, actually, rewrite some of it in Rust by hashmal on Wednesday July 12, 2017 @12:14PM (#14753757)
the cool thing about rust is that you can use it for real-time programming, one example being DSP/audio. it often means no locks, nothing blocking, no dynamic allocation (malloc and most other allocators do not provide upper bounds of execution time), no recursion, and others.

haskell is not tailored for that.

of course there are other domains for which haskell is top-nocth and rust falls flat.

Re:Why you should, actually, rewrite some of it in Rust by AnimalMuppet on Wednesday July 12, 2017 @12:28PM (#14753901)
Minor nit: I believe that you can get memory allocators that provide upper bounds of execution time. But it won't be the default allocator in most languages. Also, you need an allocator that cannot ever fail to return a valid block. Even if you have all that, it still makes it much harder to prove that your worst-case timing is fast enough.

So, yeah, no allocations in situations like that. Allocate at start-up, and re-use your buffers (for that kind of code).

Re:Why you should, actually, rewrite some of it in Rust by hashmal on Thursday July 13, 2017 @09:11AM (#14760923)
I think there are memory allocators that provide bounds, yes, but I never bothered finding one. Time-constrained code is so demanding already that handling the memory part is just one drop in an ocean of constraints. (and the whole thing is actually very interesting to do!)