views:

323

answers:

4

When working on hobby projects I really like to program in low-level languages (in the sense that C and C++ are low level). I don't want to work with managed languages with garbage collection and whatnot that takes all the fun away (yeah, we're all different ;-) ).

Normally I use C++ for these type of projects. C++ is rather complex and not so elegant so I have been looking for a language to replace it. Anybody can give me suggestions?

Preferences (not requirements):

  • should be low-level (like C and C++)
  • compile to native code (kind of follows from the above but no harm in being explicit)
  • preferrably target win32/win64
  • object oriented
  • statically typed

I have looked at Objective C but I don't like it.

+11  A: 

D? (Wikipedia page)

The D language is statically typed and compiles directly to machine code. It's multiparadigm, supporting many programming styles: imperative, object oriented, and metaprogramming. It's a member of the C syntax family, and its appearance is very similar to that of C++. For a quick comparison of the features, see this comparison of D with C, C++, C# and Java.

I think that covers everything in your requirements except Windows support, which it has too.

Note that it has garbage collection, but your question seems to associate garbage collection with being managed - they're not the same thing. I believe garbage collection can be pretty tightly controlled in D.

I should note that I have absolutely no experience in the language whatsoever :)

Jon Skeet
Just on a side note, it has garbage collection but can be disabled (its on by default so needs to be disabled manually)
hasen j
I was going to suggest D, but it is garbage collected by default. I guess I just learned something - stop that! :-P
Harper Shelby
Also, the question seems to associate garbage collection with being a managed language - that's not necessarily true. (Objective-C has garbage collection too, IIRC, but isn't managed.)
Jon Skeet
I've looked into D a while ago and I must admit, it looks interesting. While still being fairly low level (it however has those first class arrays which I don't like in a low level language ;-) ) it adds things like contracts which all languages should have, high or low level.About GC, I don't think a language having GC means it's managed. The other way around (managed language has GC) is more what I meant in the question.
vonolsson
+2  A: 

Delphi? Pascal syntax, but still quote powerful and just a little more high-level than C++.

OregonGhost
+3  A: 

Requesting no gc is rather strong and eliminate almost every modern language - things like Ocaml, for example, fill all the other requirements.

There is also ADA which fill every of your desire, but that's a very strict language. The syntax is somewhat similar to Pascal I think, and the language has much less holes compared to C. It has built-in support for threads and 'modules' (better than C headers).

David Cournapeau
+1  A: 
mamboking
Don't forget Modula-2 in that list ;-)
trijezdci