Nishant George Agrwal
Nishant George Agrwal

Reputation: 2197

Is there any high-level, natively-compiled object-oriented language in wide use?

There are lots of oop languages, but I couldn't find any that has conveniences like garbage collection, but compiles natively to machine code. Sort of like between C and java/c#. One interesting language I found was Vala, but that's limited to the GNOME platform and is not that well-known

Upvotes: 0

Views: 1823

Answers (3)

Jozzan
Jozzan

Reputation: 1

In the case you want to use an oo language that compiles down to native code you will "always" have to use header files and stuff as the elf format doesn't support oo (There is no class information in elf).In case you want to use classes from external libs you need to make the compiler aware somehow about the fact that there are classes, functions, etc. that are declared outside of your project. In C++ this is solved by the use of header files. So that's, I think, a major drawback in native object oriented languages. To resolve that issue a few tweaks would need to be made to elf/loader/linker in order to support the kind of features (like "linking" against "classes") you might expect. Even though mechanism for garbage collection could be implemented even in native languages. But that seems no good for os implementation.

There are C++ libs to do that for userspace apps like:
Boehm collector
Smart pointers

Upvotes: 0

mikera
mikera

Reputation: 106351

Go is probably closest.

But why on earth do you want it natively compiled anyway?

JIT compilation of portable bytecode has proved to be an extremely effective strategy. It compiles down to native code at runtime (so you get up to the performance of native code after the first few iterations) and it avoids the issues of having to build and manage platform-specific compiled binaries.

Upvotes: 1

Cole Tobin
Cole Tobin

Reputation: 9430

Are you thinking about C++? That is in high usage and can be compiled on nearly any (major) platform.

Upvotes: 0

Related Questions