4 ms·
Easy interaction with other languages is a double-edged sword. Too much of foreign calls may lead to unmaintainable code when knowledge of both languages and th
by fpoling 10y ago
Easy interaction with other languages is a double-edged sword. Too much of foreign calls may lead to unmaintainable code when knowledge of both languages and their libraries is required to even understand what is going on. And of cause, it makes it even harder to use a whole-program static verification as the tool now must understand both languages.
- pron 10y agoTrue, but this downside is still orders of magnitude less costly than rewriting "all" widely used C code out there. This is good as a limited exercise to learn the strengths and limitation of a new language, but as a serious undertaking a gross misuse of resources. Besides, by the time it's done, there will be a new language out there, with the same downside you point out. To avoid it, the software industry would basically do nothing but rewrite legacy code over and over.
- fpoling 10y ago"No so easy to use" does not mean no re-use. For this reason I really like how Elm interacts with JavaScript. The language requires to define so-called ports that provide explicit bindings to-from JS world. Thus it is not worth the efforts to call into JS function that does some trivial stuff. But interacting with bigger libraries is straightforward. As a big bonus guarantees of Elm's type system survive interaction with those libraries (unless the JS code in those libraries is malicious), so one does no need to know the details of those libraries to reason about Elm code. Note that from this point of view rewriting C runtime library in Rust is not good as it creates too tight coupling between C and Rust worlds, requiring to write in a rather unnatural style in Rust. Besides, a lot of Musl essentially translates C calls into kernel ones when Rust typesystem brings no advantages.