3 ms·
Re the C part. Yes. A lot. You lose all the expressivity of your type systems and the way you manage memory. Plus you have to deal with the lack of specificatio
by di4na 4y ago
Re the C part. Yes. A lot. You lose all the expressivity of your type systems and the way you manage memory. Plus you have to deal with the lack of specification of the C ABI.
See https://faultlore.com/blah/c-isnt-a-language/ https://faultlore.com/blah/c-isnt-a-language/
- lll-o-lll 4y agoYou loose the expressiveness, no argument there. The poetry is not visible. Still, that’s just a matter for a wrapper in the consuming language. E.g. beautiful Rust wrapper -> “Ugly C interface” -> “Ugly C interop layer” -> beautiful Go library I mean, it’s a pain to maintain “ugly C interop”, but as these tend to be built after the fact anyway, other than cost I don’t see anything lost.
- di4na 4y agoNope, you cannot because there is information lost in the middle that means that some of what you wanted to express in order to make it beautiful in Go is not there anymore. The medium is lossy and you cannot recover from it.
- lll-o-lll 4y agoWhat is beautiful in one language is often hideous in another. Translation is required. Much like with human translations of poetry. A good translation is not word for word, the translator captures the essence and re-expresses it in the other language. When done well, it is frankly a work of genius. So the C interface is just a medium a “translation dictionary” if you will. To do it well requires the author of the wrapper to express the ideas in a form palatable to users of the other language. I get that this is not always done well, requires a bunch of work, and may raise the question “why not re-write?”. I’m happy to consider better alternatives.
- di4na 4y agoYou realise that the medium language is incapable of expressing that? And yes, there are wip to a superset ABI
- linuxftw 4y agoThe example for OPEN(2) isn't for Linux, it's for glibc. Languages are free to implement system calls and bypass glibc if they wish. This isn't the case on BSD as the libc implementation is the official interface, but nobody is forcing anyone to write C. The fact is, lot's of interesting software is written in C, and most people want to use it rather than re-implement things that have worked for decades.
- di4na 4y agoYes and no. In a way, yes we are forced to interact with C. The syscall are in C and the ubiquitiness of C has made it de facto the thing you need to limit yourself to.
- linuxftw 4y agosyscall's are not in C. They are an interrupt instruction and some parameters in registers, and these can be emitted in a variety of languages. You only need to use C if you want to use libc of the platform.