Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

My personal programming background is mainly in Java, with a little bit of Ruby, a tiny bit of Scheme, and most recently, due to some iOS development, Objective-C.

In my move from Java to Objective-C I've really come to love some features that Objective-C has that Java doesn't. These include support for both static and dynamic typing, functional programming, and closures, which I'm trying to leverage in my code more often. Unfortunately there are trade-offs, including lack of support for generics and (on iOS at least) no garbage collection.

These contrasts have lead me to start a search for some of the programming languages that support the following features:

  • Object Oriented
  • Functional Programming Support
  • Closures
  • Generics
  • Support for both Static and Dynamic Typing
  • Module Management to avoid classpath/dll hell
  • Garbage Collection Available
  • Decent IDE Support

Admittedly some of these features(IDE support, Module Management) may not be specific to the language itself, but obviously influence the ease of development in the language. Which languages fit these criteria?

share|improve this question
I reworked the question to be less subjective (the reason it was closed). Hopefully I've succeeded. – donalbain Apr 13 '11 at 18:04
Thats good atleast you have upvotes. Looks like C# is a winner, Visual Studio is an excellent IDE IMHO. – Joe Apr 13 '11 at 18:05
As a side note, Objective-C doesn't have generics like Java because they're not really necessary (or even that meaningful) in a dynamically-typed language. – mipadi Apr 13 '11 at 18:16
how strict are you about the meaning of "garbage collection support"? Vala for example uses (automatic) reference counting for memory management, instead of the typical .net/java gc. – Tedil Apr 13 '11 at 18:18
1  
@donalbain: I suppose...except every object is an id, so everything but the C-ish parts (i.e., primitive types like float and int) are effectively dynamically typed. – mipadi Apr 13 '11 at 18:29
show 2 more comments

migrated from stackoverflow.com Apr 13 '11 at 18:11

12 Answers

up vote 13 down vote accepted

Your list is pretty much the feature set for C# and the .NET Framework.

C# Supports:

  • Dynamic typing (via dynamic keyword)
  • Object Oriented Programming
  • Functional Programming Constructs
  • Closures (with Lambdas)
  • Generics
  • Module Management via the GAC
  • Garbage Collection
  • Great IDE Support (via Visual Studio)
share|improve this answer
5  
Except that C# only supports a very small subset of "functional-ish" and the syntax is very non-"functional-ish" (which is very irritating and increases the number of side-effects required). Perhaps F# (just limiting to endorsed .NET MS languages that come with VS) fits this exact list better? (I don't use F#). – pst Apr 13 '11 at 17:41
2  
@pst - If C# only supported a very small subset of "functional-ish" features...the book Real World Functional Programming (that shows F# and C# examples side by side for nearly everything) would be pretty damn short. I agree that the syntax isn't always the most beautiful, but C# can do everything F# can. – Justin Niessner Apr 13 '11 at 17:42
6  
@donalbain Pattern matching, lazy evaluation / thunking, currying (implicit or explicit), and a syntax which allows one to avoid side-effects are some that come to mind. Just because a language has closures and lambdas, does not make it a "functional-ish" language. It makes it a language with support for closures and lambdas (which are very good features anyway!) -- Consider JavaScript. – pst Apr 13 '11 at 17:46
2  
@Justin Niessner Side-effects can exist within a single method body. The fact that if/then and friends are not expressions is really irritating at times :( Ruby endorses side-effects, but still has a rather "functional-ish" syntax. – pst Apr 13 '11 at 17:53
4  
There's a big difference between something being possible and being convenient and elegant to use. – Mladen Jablanović Apr 13 '11 at 18:24
show 10 more comments

I still say (like I did in the other question) that you try Scala, yes the IDE support is not that great, but it is getting better.

share|improve this answer
I definitely agree. What I guess I'd really like to know is what IDE currently has the best support for Scala. – donalbain Apr 13 '11 at 17:46
LOL and why did you answer the same question twice within a half hour?? stackoverflow.com/questions/5652948/… – Joe Apr 13 '11 at 18:04
@Joe cuz that question was closed so people searching for this type of question will not look at it. Now someone searching for this type of question will get this answer... – Tnem Apr 13 '11 at 18:07
About IDE support: IntelliJ IDEA (the latest version) is quite good, actually. And Eclipse plugin for Scala suddenly started to show signs of improvement, so there is hope :-) – artem Apr 14 '11 at 0:05

How about F#? (Hello World! Video)

(I don't use F#. However, it should fit the "Functional Programming Constructs" better than C# and be on par in all the other categories, although perhaps the IDE support is less? Again, I don't use it.)

In any case, there was no post for F# and it was feeling lonely.

share|improve this answer
I'm very curious to find out more about the pros and cons of F# with respect to my criteria. – donalbain Apr 13 '11 at 17:55
@donalbain Me too! I have made this into a CW, so hopefully some F# proponents can update it. – pst Apr 13 '11 at 17:57
2  
Compared to Justin's answer, F# has more functional features, but a little less IDE support (no WPF designer). However, you can put your GUIs in a C# dll, and reference them from F#, or just define the WPF by hand in F#, which is closer to what I've been doing recently in C# anyway. – Scott Whitlock Apr 13 '11 at 19:04

Common Lisp/CLOS. I'm not sure what you mean by module management though.

share|improve this answer
If I'm not mistaken CLOS and Ocaml are fundamentally functional languages that were made "object-y". I'm wondering how these implementations differ from object oriented languages that have become "functional-y". – donalbain Apr 13 '11 at 18:34
by Module Management I'm talking about stuff like OSGi for java and The Global Assembly Cache of C#. – donalbain Apr 13 '11 at 18:43
1  
@donalbain: Common Lisp evolved from a largely functional language, so it's still possible to do whatever you want with functional programming. Languages that started out O-O typically don't have the same facilities for functional programming. – David Thornley Apr 13 '11 at 21:22
@donalbain, Common Lisp is not a functional language now and it never was functional enough (for the same reason as C# - proper tail calls support is not guaranteed). It is a multiparadigm language from its very beginning, with only rudimentary support of functional programming. – SK-logic Apr 14 '11 at 9:53

Ocaml support everything you state but the IDE. F# looks to be like a OCaml on .NET with visual studio.

share|improve this answer

There is this wondeful C++ like language known as D. I have used it very little, though when I have done so it was great. It supports all the features you asked for. I have just used Vim+GDC, but there seems to be OK IDE support as well.

share|improve this answer

Clojure has all of these apart from the fact that it's not object oriented - it's unashamedly functional throughout.

Some consider not being object oriented an advantage. I strongly recommend this video by Clojure creator Rich Hickey to explain why:

On top of that, Clojure has some additional features that you may find particularly valuable:

  • Concurrency capabilities with software transactional memory
  • It's a homoiconic language which enables powerful metaprogramming capabilities
  • It's a JVM langauge with access to the entire Java library ecosystem - so no worries about lack of library availability!

Overall, worth a try if you want to escape the straightjacket of mainstreamm OOP languages and live a bit closer to the cutting edge.

share|improve this answer

Ada 95 should meet those criteria, though any good IDE is probably expensive. Ada wasn't widely used, but those who did use it tended to get paid well... Don't know what the current usage is.

share|improve this answer
Ada has dynamic typing? It doesn't seem like the US military would be cool with the possibility of their Missle objects being interpreted as Soldier objects no? – donalbain Apr 13 '11 at 19:15
2  
You didn't ask for "dynamic typing", did you? – Ingo Apr 13 '11 at 20:34
Woops, that was my mistake. Corrected my question. – donalbain Apr 14 '11 at 5:53
Ada compiler and IDE (for free) is available for example from AdaCore. Compiler is called GNAT, and is based on GCC. Their IDE is called GPS. Ada2005 still does not support dynamic typing though, so perhaps this is not what the OP wanted. – Schedler Apr 14 '11 at 10:59

Answer to @CRD et al.:

There are Ada83, Ada95 then Ada2005 with Ada 2012 now pending. No, Ada is a strong typing language therefore it is more suitable for mission/safety critical applications. That does not mean Ada is only for aerospace and military applications. Business, as we know, is also mission critical nowadays. My company uses (mostly 95-100%) Ada to develop server-side applications for manufacturing, retail, healthcare and many more other business sectors.

I published a paper for my former company. You can read it here: http://adrianhoe.com/adrianhoe/publication/papers/software-development-reengineering-an-experience-report/

As far as Ada is concerned, there is no garbage collection and one does not need it in Ada but that doesn't mean you can't implement garbage collection in Ada. The approach will be Initialization and Finalization as to speak of Ada.

As for generic, Ada has the most elegant implementation IMHO. Creating reusable libraries with generic is easier to understand.

share|improve this answer

Perl6

Perl 6 supports your requirements. It also is a great language with a large community!

share|improve this answer

I think that the Groovy language is closest to your requirements.

  • Object Oriented - indeed, classes, inheritance, etc.
  • Functional Programming Support - not so good, it mostly "mutable" by default, but...
  • Closures - are supported and used well by the standard and third-party libraries.
  • Generics - the same as in java.
  • Support for both Static and Dynamic Typing - you can avoid type declarations if you want to. All the methods calls could be dispatched in runtime by reflections.
  • Module Management to avoid classpath/dll hell - standard java tools like maven and OSGi are available.
  • Garbage Collection Available - of cause.
  • Decent IDE Support - there is pretty IDEA support for it.

I'd say that if you are more interested in tools and dynamic typing you should inspect Groovy and if you more interested in FP you should have a closer look at Scala or F#.

share|improve this answer

The closest to your requirements are:

  • C#
  • VB.NET
  • Ada
  • Object Pascal / Delphi
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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