Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

clojure vs scala

 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do they compare against each other ?
 
author
Posts: 22
VI Editor Clojure Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clojure and Scala have a lot in common. Both provide support functional-style programming and make some effort to address concurrency issues. Both provide compilation to .class files as well as interactive prompts (REPLs) for interactive development. Both enjoy support in various IDEs. Both compile to Java bytecode and run on the JVM, and both have had efforts to bring them to the .Net CLR. Both languages make it easy to use libraries provided by Java.

But of course there are also differences:

Scala's syntax is inspired by Java's, though I dare say it's got quite a bit that doesn't look that much like Java anymore. Clojure's syntax is inspired by LISP, but has its own extensions as well.

Clojure doesn't provide as much support for imperative-style programming as Scala, preferring to stay simpler and more firmly in the functional camp. In fact, simplicity and separation of concerns (not tangling different ideas into a single feature) is something you'll find throughout Clojure's design, a goal that I'm not sure Scala holds in such high regard.

Clojure never requires the types of arguments or locals to be specified in the code, falling back on runtime reflection when necessary. Scala on the other hand requires the type of everything to be known at compile time, though it does have some type inference so you don't have to write out the types of things quite as often as in Java. This is good because Scala's static type system is significantly more complex than Java's.

While I've never tried to use a Scala library from Java, my understanding is that it can be tricky and/or messy. However Clojure's gen-class and deftype macros make it easy to write very clean libraries for use in Java code that may have no idea the library it's using was written in Clojure.

I'm sure there are other significant differences, but I hope this gives you a feel for how the languages compare.
 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dears Michael and Chris,
Since you are working on Scala and Clojure, do you see that Java the language has reached an end on life point?
Sure it will be still used in the enterprises as the business language but do you think it will be eventually be replaced by another language (also sometimes called Java.next)?
 
Pradeep bhatt
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Chris. Like groovy are java apis available from clojure.
 
author
Posts: 12
Monad BSD Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

John Todd wrote:Since you are working on Scala and Clojure, do you see that Java the language has reached an end on life point?



Java is like the old man from the "bring out your dead" scene in Monty Python's Holy Grail. People are often claiming that it's dead, yet it keeps on ticking. I don't think Java has reached the end of its life yet.

John Todd wrote:Sure it will be still used in the enterprises as the business language but do you think it will be eventually be replaced by another language (also sometimes called Java.next)?



If history has anything to say about it then inevitably something else will come along to steal the majority share of programming job listings. Who knows what it will be. I'm hoping Clojure, but I might be a bit biased.

 
Hussein Baghdadi
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Me too, I hope it will be Clojure and let the aliens prevails
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic