6 ms·
Thankfully C++ is far from the only language that compiles to native. Many others don't even have the same insane "features".
by dullgiulio 7y ago
Thankfully C++ is far from the only language that compiles to native.
Many others don't even have the same insane "features".
- jokoon 7y agoThere are not that many languages with good support that compile to native.
- pjmlp 7y agoJava (yes it does, since around 2000), .NET (NGEN since v1.0, Mono AOT, IL2CPP, .NET Native), D, Eiffel, FreePascal, Delphi, RemPascal, Swift, OCaml, Haskell, Lisp, Ada, Scheme, Basic, Go, Fortran. Just a couple of possible languages, there are many more if we take out the good support constraint.
- jokoon 7y agoGarbage collected languages are not really native languages. I don't see good enough alternatives to C++, which have enough support, not a steep learning curve, good backward compatibility with existing ecosystems, not owned by a single company, etc.
- umanwizard 7y agoDepending on your definition of "enough support", Rust might be what you want. > not a steep learning curve well, it's steeper than most languages, but less so than C++ IMO, especially if you're already familiar with C++ and therefore understand the problems Rust is intended to solve.
- jokoon 7y agoIf you already know C, C++ is easier. You can still pick what you like in C++. Still ,there aren't that many languages that compile to native.
- pjmlp 7y agoYeah the list is indeed quite small. https://en.m.wikipedia.org/wiki/Compiled_language https://en.m.wikipedia.org/wiki/Compiled_language
- jokoon 7y agoWhen you cross that list with language usage, support etc, you don't have a lot left. My point is that maybe most of those languages are not suitable, and that nobody really like those languages. Just cross all the arguments I gave about those languages, how they score, etc: C/C++ are the most used language that compiles to native and it gets criticized. "There are languages people complain about, and languages people nobody uses" Meaning we only complain about language we use.
- pjmlp 7y agoSays who? They also compile to native code just like C++. If having a GC makes a language not native, then C++ isn't a native language as well. ISO C++11 introduced the GC API, C++/CLI and C++/CX dialects use a GC, Unreal C++ has a GC, regular C++ with Boehm GC is another option, C++ Builder has also a GC. ISO C++ is basically driven by Microsoft, Google, Apple, IBM, given the amount of employees that go to ISO meetings and submit papers. While it isn't a single corporation, it isn't a community driven process either. Who can put money on ISO get the features.
- pix64 7y agoThe majority of those are garbage collected and the one's which aren't are obscure.
- pjmlp 7y agoSo what? They also compile to native code
- a1369209993 7y agoTo clairify (because usually noone ever does and the conversation goes around in circles) "compile to machine code" (in the conext of language design, rather than implementation details) means, idiomatically, to compile specific parts of the program to specific and (allegedly) predictible pieces of machine code. This is standard in C (and allegedly C++ and rust), awkward but somewhat doable in Java, C#, and some of the weaker LISPs, damn near impossible in Haskell, Javascript, etc, and completely impossible in "real" LISPs (with first-class macros and/or fexprs). It's obviously always possible to "compile" a (interpreter,somewhat-preprocessed-program) tuple for any language (give or take turing-hard/easy-ness) and you can usually inline/specialize/optimise the interpreter a lot for one particular program (Haskell/ghc is a good example of this), but that's not what people mean when they talk about designing a language to compile to machine code.