6 ms·
Languages exist that compile to C which gives them many of the above advantages and more, so why choose C over them?
by WithinReason 5y ago
Languages exist that compile to C which gives them many of the above advantages and more, so why choose C over them?
- raptorfactor 5y agoHaving never used such a language, I'm curious, what's the debugging experience like? Can I source level step the application in the original language or do I have to debug the generated C?
- rwmj 5y agoOne of the criteria is "excellent debugging support" which you don't get with transpiled languages, since you'll be buried in generated code when you open the debugger.
- pjmlp 5y agoLanguages like Eiffel prove this isn't the case, it is a matter of proper debug tooling.
- zabzonk 5y agoOf course, Eiffel is such a popular and widely used language, with a great toolset. /s
- pjmlp 5y agoThe amount of users doesn't change the fact of the tooling quality, but no wonder, UNIX folks tend to only take free beer, so what do they know about fine wine.
- zabzonk 5y agoI've read the Eiffel books, and tried to use the Eifell tools, on Windows - a horrid experience. I am not a "UNIX folk" and I can't imagine what comparing UNIX and Eifell has to do with anything. It is basically an unuseable programming language and toolset, promoted by an egomaniac with a grudge against C++. If you disagree, please provide a link to something medium sized and useful written in Eifel.
- pjmlp 5y agoUseful to whom? To you or the companies that keep Eiffel Software in business for 30 years?
- zabzonk 5y ago> the companies that keep Eiffel Software in business for 30 years? Such as? If you can't provide links to people using Eiffel succefuly, then maybe there are none.
- pjmlp 5y agoI can provide them, but you apparently will ignore them anyway, because it is clear a company can exist for 30 years without money. Here is one, just to keep you happy. https://washingtontechnology.com/2003/06/tech-success-xontech-uses-eiffel-for-defense/354257/ https://washingtontechnology.com/2003/06/tech-success-xontec... Yes, the article is from 2003, then again you haven't asked for dates, but to make it easier on you, you can ask them how they feel about Eiffel in 2022. https://www.xontech.md/en/ https://www.xontech.md/en/
- xigoi 5y ago
- 10x-dev 5y agoControl over the code that actually runs. We already lose quite a bit of control with C (e.g. it reorders your code as it pleases) to gain portability across CPUs, otherwise we'd have to rewrite the code in several assembly languages. If you consciously choose to give up even more control over the code that runs (because a compiler that targets C necessarily adds another layer of autogenerated code that you don't control) then it better be a wise tradeoff.
- WithinReason 5y agoThe downside of reordering being performance? Or something else?
- 10x-dev 5y agoPerformance is usually the upside. The downside is subtle bugs that can happen due to side effects of the statements being reordered between sequence points.
- WithinReason 5y agoAFAIK compilers don't reorder if it would change the result.
- Thiez 5y agoCompilers not allowed to violate the language spec when optimizing. But the spec may be fairly generous in its allowed interpretations, which may not match what a programmer may naively expect. C, with its many undefined behaviors and implementation defined behaviors, is especially dangerous.
- dig1 5y agoDepending on transpiler (compilers that will compile to C), you can get near representation in C (rarely) or something completely different (frequently). In Scheme/LISP world (where transpilers were popular for a while), even a simple expression like "(+ 1 1)" will rarely give you something like: "int a = 1 + 1;". I've seen these things would produce dozen of lines of various boxing/unboxing calls, type checks and GC protection marks. If the compiler is really aggressive, it will just put "2" as a constant. I think that the only benefit of "compiling to C" was reusing existing compilers, not tooling around it. Also, debugging that code is a nightmare unless you are intimate with transpiler internals.
- sys_64738 5y agoA compiler that translates to another language used to be called a translator.
- zabzonk 5y agoAll compilers covert programs in one language (say C) into another, (say assembler or machine code), and they are called compilers. The whole transpiler thing is a bit bogus, but a C compiler has never IME been called a translator.