4 ms·
Or even better, Haskell!
by kreetx 9y ago
Or even better, Haskell!
- skybrian 9y agoIf you rewrote only part of a large C++ project in Haskell, is there a way to link it back in again?
- aeorgnoieang 9y agoCall Haskell from C (not C++) seems pretty easy: - [Calling Haskell from C - HaskellWiki](https://wiki.haskell.org/Calling_Haskell_from_C 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_application_in_C_or_C.2B.2B https://wiki.haskell.org/Introduction#I_already_have_a_large.... So apparently it is doable!
- mrkgnao 9y agoHN supports a funky subset of Markdown. :(
- concede_pluto 9y agoOnly paragraphs, code literals, italics, and URLs. https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc
- antientropic 9y agoIt pulls in a huge runtime system, though (including stuff like garbage collection). This makes it much heavier than calling some Rust code.
- marcosdumay 9y agoTrue, where "huge" means something around 10MB. For many projects that is a showstopper.
- mrkgnao 9y agoThe URL is slightly misleading: yes, you can call Haskell from C++. https://stackoverflow.com/questions/3859340/calling-haskell-from-c-code https://stackoverflow.com/questions/3859340/calling-haskell-...
- kreetx 9y agoIt 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.
- hashmal 9y agothe 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.
- AnimalMuppet 9y agoMinor 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).
- hashmal 9y agoI 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!)