When comparing Clojure vs Pony, the Slant community recommends Clojure for most people. In the question“What are the best (productivity-enhancing, well-designed, and concise, rather than just popular or time-tested) programming languages?” Clojure is ranked 11th while Pony is ranked 26th. The most important reason people chose Clojure is:
Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default. State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity).
Ranked in these QuestionsQuestion Ranking
Pro Immutability is the default
Clojure programmers are highly encouraged to use immutable data in their code. Therefore, most data will be immutable by default.
State change is handled by functions (for transformations) and atoms (an abstraction that encapsulates the idea of some entity having an identity).
Pro Minimal syntax
Being a LISP, programs are simple: they're just functions and data. That it doesn't get bogged down with syntax or the loftier FP concepts like monads makes it one of most approachable functional languages for beginners.
Pro Tries to solve problems as simply as possible
Simplicity is one of the pillars on which Clojure is built. Clojure tries to solve many problems in software development as simply as possible. Instead of building complex interfaces, objects or factories, it uses immutability and simple data structures.
Pro Good for writing concurrent programs
Since Clojure is designed for concurrency, it offers things like Software Transaction Memory, functional programming without side-effects and immutable data structures right out of the box. This means that the development team can focus their energies on developing features instead of concurrency details.
Pro Huge ecosystem of libraries to work with
There's a very large ecosystem of high-quality Clojure libraries which developers can use. One example is Incanter. It's a great data analytics library and a very powerful tool for dealing with matrices, datasets and csv files.
Pro Cross platform
Clojure compiles to JVM bytecode and runs inside the JVM. This means that applications written in Clojure are cross-platform out of the box.
Pro Rich Hickey
The creator is so awesome, he's a feature. Just look up his talks and see why.
Clojure has an elegant macro system which enables language additions, Domain-specific languages (DSLs), to be created much easier than most other languages (with the exception of Racket, perhaps).
Pro Dynamic language
A superb data processing language. While rich type and specification systems are available they are optional.
Pro Great tool used in automating, configuring and managing dependencies available
Leiningen is a very useful tool for Clojure developers. It helps wiht automation, configuration and dependency management. It's basically a must for every Clojure project.
Pro Game is available with which you can learn Clojure
Nightmod is a tool used to make "live-moddable" games. It displays the game's code while you are playing and allows you to inject new code using Clojure. This can be a fun and useful experience for people trying to learn Clojure.
Pro No C/Java syntax
Pro Concurrency model based on actors
The unique type system allows the compiler to automatically schedule actors on threads, giving you reliable concurrency for free.
Because of its capabilities secure type system, provided you don't use the C FFI, references will never be stale, race conditions are effectively impossible, deadlocks don't happen because locks and mutexes are never needed, and processes never crash because all exceptions must be handled. (Barring compiler bugs or external memory corruption, of course.) Pony programs can still lock up due to infinite loops, like any Turing-complete language.
Pro Trivially simple C FFI
Calling low-level C functions is as simple as
use "lib:clibrary" and
@c_function_name[return_type](parameter:type). Linking C to Pony libraries is just as easy, as the Pony compiler will generate appropriate header files.
Pro High performance
Compiles to native code, and features an intelligent garbage collector that takes advantage of the actor architecture to get essentially free garbage collection.
Con Confusing error messages
Clojure's error messages more often than not are very confusing. They usually involve stack traces that do not thoroughly explain where the error was caused or what caused it.
Con Tied to the JVM and it's limitations.
Some language constructs were obviously created as workarounds for JVM limitations. This makes the language much less elegant than it could have been.
Also, the JVM has a very cumbersome FFI.
Con Dynamic types
You can put anything in. This makes reasoning about code after a time has passed very hard.
Con Syntax can be alien / jarring for those used to other Lisps
Perhaps some may consider this attribute an advantage, but I do not. Clojure does not attempt to maintain significant compatibility with other Lisps. So, if you already know a Lisp or are used to the way Lisp works in general, you'll probably be confused if you take a look at Clojure. See these resources for more details on this subject:
Con All exceptions must be caught
The compiler enforces this, so code is littered with
Con Limited documentation
As Pony is such a new language, documentation is relatively light, and tutorials are few and far-between.
Con Few libraries
Con Limited tooling
There's no IDE. Debuggers are fairly basic. Pony is too young to have much of an ecosystem.
Con Garbage collector can't run until you yield
A long-running behavior can leak memory because the garbage collector has no chance to run.
Con Divide by zero is allowed
And instead of some sensible result like NaN or Inf, the answer is zero! Most languages would just raise an exception (and Pony used to do this), but since the compiler enforces the rule that "all exceptions must be caught" the proliferation of
trys was determined to be too burdensome on the programmer. This makes the whole design of the exception system questionable.
Con Unstable API
Pony is not ready for production. It has yet to release version 1.0, and there are frequent breaking changes.
Con Difficult learning curve
The type system uses a capabilities-oriented approach to reference semantics, which can be difficult to wrap your head around at first. The lack of more common object-oriented features and the preference for simplicity over familiarity can make it difficult for new users to model their program design.