Take the 2-minute tour ×
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.

I want to choose to learn a functional programming language, it should fulfill the criteria:

  1. Open source, static typed & fully object-oriented too.
  2. Must has web framework because it's for web development.
  3. I want to avoid oracle jvm altogether, therefore not scala, clojure.
  4. Should be rather popular, i.e. has real-world applications in industry.

Please recommend which good language I can use? thanks.

share

migration rejected from stackoverflow.com Sep 19 '13 at 2:01

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by gnat, MichaelT, GlenH7, Dan Pichelman, mattnz Sep 19 '13 at 2:01

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." – gnat, MichaelT, GlenH7, Dan Pichelman, mattnz
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Functional Programming languages rarely contain OOP features. They tend to contain functional programming features. Besides, "What is the best X" questions are not on topic. –  Rein Henrichs May 3 '11 at 21:49
    
@Nobody, it's possible for a language to be functional and object oriented, just not purely. They call these multi-paradigm languages. –  Arelius May 3 '11 at 21:52
    
@Rein: The 'O' in 'OCaml' stands for 'objective.' With that said, a lot of 'real world' OCaml code doesn't actually make use of OO features, because those features integrate poorly with idiomatic use of the rest of the language. –  phooji May 3 '11 at 21:57
    
Why those requirements? –  mipadi May 3 '11 at 21:57
3  
@Rein "What language should I learn next" are usually off-topic as well, although this one does seem to fill the "specific requirement" criteria. –  Anna Lear May 3 '11 at 22:13

7 Answers 7

You've already narrowed down your choices very quickly here.

Open source, static typed & fully object-oriented too. Should be rather popular, i.e. has real-world applications in industry.

Popular leaves us with the big ones, Clojure, Lisp, Haskell, ML, Erlang. I might be missing a few here, but those are most of the big ones.

Static typing removes most of those, basically leaving you with Haskell, and ML.

Haskell isn't object oriented, and doesn't really support that manner of programming, and neither is most variants of ML afaik.

That basically leaves you with OCaml, however It's unclear to me how their web framework is. It probably exists, but I doubt it would compare to RoR or whatever. You are capable of rolling your own however.

Edit: F# may also fit the bill, it's very similar to OCaml, and runs on the .net platform.

share
    
Although F# isn't open source. Still, +1 because it's a good answer. –  Peter Taylor May 4 '11 at 12:33
    
Ohh, huh. I had assumed there was a Mono port or some such. –  Arelius May 4 '11 at 19:41
    
I admit that I hadn't thought of that, but a quick look around suggests that people use a Microsoft closed-source binary under Mono for F#. –  Peter Taylor May 4 '11 at 21:16
    
See tirania.org/blog/archive/2010/Nov-11.html, but the short version is that F# language and compiler are apache2 licensed and will be distributed with mono. Now, all bets are off until the smoke clears after novell fired the mono dev staff . . . –  Wyatt Barnett May 4 '11 at 22:34

I can't think of a language that meets every criteria, but if you want to preserve object-orientation, you need a multi-paradigm language like F#.

Tomas Petricek has written a web framework for F# that has some interesting features, see here: http://tomasp.net/projects/fswebtools.aspx

share

Another vote for F# -- it sounds like it could fit the bill. Web is still a bit rough, at least for those of us used to the .NET flagship C# but it is definitely there.

Another interesting option is Javascript -- not a purely functional language, but definitely a platform you can write in a functional style on. And node.js is a very, very interesting thing in this day and age. It doesn't fit all your requirements exactly, but it fits the important functional ones by and large.

share
1  
+1 for JavaScript--it isn't statically typed and it isn't purely functional, but you won't miss the type system (and, moreover, things like object literals wouldn't be possible with static typing as far as I know) and you can write some very interesting code with node.js. –  Tikhon Jelvis May 4 '11 at 7:11
    
Yup, lots of the dynamic stuff that got added to the CLR was a direct result of MS research making F# a first class citizen. –  Wyatt Barnett May 4 '11 at 22:32
    
I miss the type system every time I have to code in JavaScript. –  Arelius May 4 '11 at 23:36
    
I miss intellisense, but duck typing has quite a bit going for it after you get past the initial shock. –  Wyatt Barnett May 5 '11 at 17:01

So you want a functional programming language that is fully object oriented? You are making it difficult without Scala programming language.
Scala fits your requirements, why you don't want a JVM based solution?

share
    
Not to mention that Scala can run on the CLR instead of the JVM –  Colin Gislason May 3 '11 at 23:55
    
@Colin, can it? Does it run well? –  Arelius May 4 '11 at 3:20
    
I have no idea, I am new to Scala so I haven't tried. But I saw it mentioned a few times on the Scala website and elsewhere. –  Colin Gislason May 4 '11 at 12:36

Seems to me you want Guile. The project just released a new version earlier this year with a new, full-featured Web programming API, and from the looks of it they'll continue giving these features a lot of focus for the foreseeable future.

Maintained as an integral part of the Guile system is GOOPS, the Guile Object Oriented Programming System. This is a powerful OO framework built on the concept of the MetaObject Protocol yielding a design that allows one to program the object system itself. GOOPS integrates quite nicely with the broader Scheme language, and though OO programming is inherently imperative, I've found mixing GOOPS with traditional functional programming techniques provides access to a rich and powerful data structuring system while allowing safe and hygienic programming overall.

Guile stands for the GNU Ubiquitous Intelligent Language for Extension, and is the official scripting and extension language of the GNU Project. A group of master hackers form the development team, and they're happy to answer questions and provide examples of real-world projects making use of their humble software. It's not as popular as, say, Python, Ruby or Perl, but if you want that perfect blend of functional and object-oriented programming, you'll do no better.

share
    
guile is dynamically typed. –  Arelius May 4 '11 at 3:18
    
You're absolutely right—that slipped my mind completely. Scheme is strongly typed, i.e. it does not allow implicit conversion, but symbols denoting values are not assigned a "type" at any time and are free to refer to values of any type even after being declared. –  Atom X May 4 '11 at 6:50

Erlang is not staticly typed but might otherwise meet your requirements, there are some very nice web frameworks for Erlang out there and it is starting to pick up some real world use outside of telecoms.

If you want static types try haskell, it has a very strong type system.

share

I think a good fit for your criteria would be CoffeeScript. It is a multi-paradigm prototype based (ie what some consider to be "true" object-orientation) language that can easily be used in the functional style. It supports first class and higher order functions, and function side effects can be removed without too much hastle. It compiles down into JavaScript code which can then be further optimised by the google Closure compiler, etc. It can be used both client side, and server side via the Node.Js web server.

share
2  
I'm pretty sure that CoffeeScript is not statically typed. –  Arelius May 4 '11 at 3:20