Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I want it will be

  • native code generation // Able to compile with something like GHC
  • cross-platform (win / linux)
  • Functional and a bit object-oriented
  • lambdas, pattern matching, tuples and other functional stuff
  • Great metaprogramming support
  • Indent and minimum borders
  • static typing
  • also I want Mixin support :)
  • possibility to build web sites based on some frameworks is also good plus.
  • so and yes, performance and stability matters.

I started Haskell, but still being not sure about it, because there is OCaml. And I've got F# experience. But as far as I know OCalm is a bit OOP and sometimes even faster (not sure about it) I never tried it. There is also erlang, I know nothing about erlang. And maybe I'm missing something more..? Python, I have no idea about python here, it's functional and it's oop and it supports mixin and popular and fast, but I don'r really think that python is able for all the functional magic, I think it can not.

I know that this thread/topic is a like a talking about nothing or like a language war, but I seriously and really want to hear your vision of it.

share|improve this question

closed as off-topic by gnat, MichaelT, GlenH7, thorsten müller, Doc Brown Sep 30 '13 at 17:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about what language, technology, or project one should take up next are off topic on Programmers, as they can only attract subjective opinions for answers. There are too many individual factors behind the question to create answers that will have lasting value. You may be able to get help in The Whiteboard, our chat room." – GlenH7, thorsten müller, Doc Brown
If this question can be reworded to fit the rules in the help center, please edit the question.

I think requiring native code generation greatly limits the options. I think nemerle is worth a shot. – back2dos May 16 '11 at 12:57
@back2dos ye, I like Nemerle, but using it with mono for small utils or web is a bit ODD job. I think so. And indent still got bad support. I'm using Nemerle, but sometimes. For now I'm using it lesser then F#. – Heather May 16 '11 at 13:04
Looks like you want C++ with a (runtime) functional paradigm (it already have compile-time functional paradigm). – Klaim May 16 '11 at 13:07
@Klaim I really don't want C++. generation native code with ghc -> gcc is OK for me. – Heather May 16 '11 at 13:10
A language with all of those requirements? Probably one you write yourself. – Rein Henrichs May 16 '11 at 15:34

4 Answers 4

up vote 8 down vote accepted

Clojure seems a pretty good fit for all your requirements.

  • native code generation / Able to compile with something like GHC - Yes (all Clojure code gets compiled to Java bytecode which subsequently gets compiled to native code via JIT on the JVM)

  • cross-platform (win / linux) - Yes - anywhere the JVM runs

  • Functional and a bit object-oriented - Yes - Clojure is a functional language first and foremost, but also has OO support if you want it (via either Java interoperability or CL-style objects). Having said that, OO is generally considered unidiomatic in Clojure.

  • lambdas, pattern matching, tuples and other functional stuff - Yes - it's a fairly standard functional language in this regard. The auther (Rich Hickey) was somewhat inspired by Haskell.

  • Great metaprogramming support - Yes - "code-is-data" applies as with all Lisps and you get great macro functionality

  • Indent and minimum borders - Yes though surely that's actually an editor rather than a language feature??

  • static typing - Yes - Clojure is dynamic by default but you can provide static or primitive type hints whenever you like for a performance boost

  • also I want Mixin support :) - Yes - can be achieved in various ways (e.g. macros) though you'll probably not want or need it after you've discovered Clojure's protocol functionality....

  • possibility to build web sites based on some frameworks is also good plus. - Yes - there are frameworks like Ring/Compojure in Clojure and you can also use any Java frameworks

  • so and yes, performance and stability matters. - Yes - You basically get all the performance /stability of the JVM which is pretty well proven in enterprise applications....

Apart from all that, Clojure has some really impressive capabilities around concurrency. It's really worth watching this video:

share|improve this answer
"everything gets compiled to native code via JIT on the JVM" Totaly wrong... compiled in native code means we don't need something like a virtual machine. Here we need it. – BenjaminB Jun 15 '11 at 9:07
It depends why you need native code. If all you care about is steady state performance then the JVM is absolutely up there with native code. If you need native libraries you can use JNI from the JVM (which is good enough for realtime 3D games). If however you need startup time in milliseconds or have severe memory constraints like on an embedded device then I agree the JVM may not be ideal. – mikera Jun 15 '11 at 11:20
mikera, you could also want ease of deployment (one less dependency for a Linux package, or not requiring the user to install the JRE on Windows, possibly even to give someone an .exe or elf). Yes, giving just a binary is a corner case, but still, it's possible with a native application but not with a program that needs the JVM. – Alexander Aug 2 '11 at 9:33
@Alexander - agree that you want ease of deployment though depending on your perspective on dependencies this can still be a plus point for Clojure: Clojure apps have exactly one direct dependency (the JVM) whereas a native binary has at least two (the operating system and the specific hardware architecture) – mikera Aug 4 '11 at 11:24
"everything gets compiled to native code via JIT on the JVM": NO. (clarify that and I remove my -1) – haylem Mar 7 '12 at 2:42

Common Lisp

It appears to support all the above requirements. The link will take you to an online book that covers everything you need to know to get started.

share|improve this answer
Common Lisp does generate native code? – Klaim May 16 '11 at 13:07
@Klaim: Common Lisp is programming language. Programming Languages don't generate code, compilers do. So, just like for pretty much every other programming language on the planet (C, C++, Java, Ruby, ECMAScript, you name it), there are compilers for Common Lisp which generate native code. And just like for pretty much every other programming langage, there are compilers which generate JVML bytecode, CIL bytecode, C sourcecode, ECMAScript sourcecode. And just like for pretty much every other programming language, there are interpreters. – Jörg W Mittag May 16 '11 at 13:22
@Klaim: Are you talking about the eval function? It's just a function, you can implement it any way you like. Some implementations have a separate interpreter which they ship with the compiled executable. Some just ship the compiler itself with the compiled executable. Some only compile the code at runtime anyway. And if you are talking about macros: those only execute at compile time anyway. That's the beauty of it. – Jörg W Mittag May 16 '11 at 13:47
@nCdy The ()s in Lisp come about as a result of providing syntax for differentiating between lists and atoms within an s-expression. – Gary Rowe May 16 '11 at 14:01
@Jörg W Mittag: I'm beginning to suspect that you just like saying the word "orthogonal". ;) – FrustratedWithFormsDesigner May 16 '11 at 14:35

OCaml is the only language providing all the features you ask for. (But I don't know for mixin.) It even has a web framework named Ocsigen and it's more than a hype language, it's an old language, with a real user base (companies, universities, hobbyist) and years of improving and testing.

share|improve this answer
But metaprogramming is only done by a single-pass external tool (CamlP4). – SK-logic Jun 15 '11 at 10:24
Note that some of today's "hype language[s]" might become tomorrow's "old language[s], with real user base[s] [...] and years of improving and testing". They might even achieve the same level of market penetration and public acceptance. :) – haylem Mar 7 '12 at 2:40

Definitely Scala can match your requirements:

  1. compiled and runs on JVM so it is win/linux/mac.
  2. supports both functional and OO programming.
  3. it supports functional stuff you mention. Pattern matching looks great and actively used. It lacks tail recursion support as JVM doesn't support it but recursion calls can be optimized in some cases.
  4. metaprogramming is not supported. The language is great^W quite good for DSL. (fixed)
  5. it has mixins (traits).
  6. have a look at Lift web framework. It uses functional features of the language and has advanced features so very interesting to look at. There are also some other web frameworks (play!, etc.)
  7. based on JVM so stable.
  8. Syntax is quite clean. There is no parenthesis hell (sorry lispers, that's just my personal opinion) over there and the use of semicolons is reduced to optional in many cases.

Moreover Scala has great support for parallel programming (by Actors). Scala community is growing and it is used in real projects (Twitter). The language is quite difficult to learn as has a lot of features and syntactic sugar but once you handle it you certainly will enjoy programming with it.

share|improve this answer
When compared to clojure Scala's trait allow mixin composistion in which trait (interface) can inherit classes via type-linearisation. – prasonscala Jun 15 '11 at 9:53
4. Metaprogramming is not supported at all. DSLs are implemented in high order functions and overloading, without any help of metaprogramming. As a result - those DSLs are limited, limiting and slow. No compile-time code generation is available in Scala. Nothing like Lisp macros. – SK-logic Jun 15 '11 at 10:24
I really dislike Scala syntax after all... It's personal ) – Heather Jun 15 '11 at 10:40
@SK-logic I checked it and now I agree with you. Once I looked through "DSL in Action" and there was Scala DSL example so I thought it is OK for DSL. Obviously Lisp, Clojure will work much better here. – make_sense Jun 15 '11 at 12:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.