When comparing Dart vs Ceylon, the Slant community recommends Ceylon for most people. In the question“What is the best programming language to learn first?” Ceylon is ranked 27th while Dart is ranked 32nd. The most important reason people chose Ceylon is:
The compiler prevents you from using a potentially null variable, unless you check it is not null. Ie. it forces you to check a potentially null value before using it. The type system is strict, but flexible, allowing union and intersection of types, covariant and contravariant types, reified types, etc. Type inference and union types allows a dynamic programming style, close of JS spirit.
Ranked in these QuestionsQuestion Ranking
Pro Great standard library
Dart includes a truly comprehensive core library, making it unnecessary to include disparate, external resources for basic functionalities Other than reducing the need to pull in various 3rd-party utilities this also ensures that all Dart code looks and feels the same.
Out of the box, the developer gets core libraries to help with: async, collections, strings, regexps, conversions, formats, file I/O, math, typed data, and more.
Pro Great async language support
Dart is a single threaded programming language. So if any piece of code blocks the execution of the program, the program practically freezes. To avoid this Dart makes use of asynchronous operations which let your program run without getting blocked. This is done through Future objects.
A Future is an object which represent a means for getting a value at a certain point in the future. A function may invoke a Future and when that happens, two outcomes can be achieved:
- The function is unable to return a value, so it queues up work to be done and returns an uncompleted Future object.
- Or later when a value is available to be returned, the Future object completes with that value.
Pro A lot of tools are available to help in developing with Dart
Dart has a lot of tools available which help with developing Dart applications. Some examples of those tools include:
- pub - package and dependency management and build tool
- analyzer - static syntax analysis with linter, quick fixes, autocompletion support for easy IDE integration
- test - powerful and flexible testing framework and test runner
- dev_compiler - generate reusable JS instead of tree-shaken minified JS output (work in progress)
- dartfmt_ - source code formatter
- server-side VM
- observatory - a powerful tool for profiling and debugging running Dart code (for Dartium and Dart server code)
Pro Will be familiar to Java developers
The language will look familiar to Java developers, easing the learning curve.
And yet, while it's similar, it has some nice syntax facilities to avoid common boilerplate code found in Java. Code is terser, yet readable.
In Dart many browser differences (subtle differences and also missing features) are abstracted away or polyfilled. When Dart is transpiled to JS the output works on all supported browsers. There is usually no need to load polyfills or to consider browser differences during development. No need for libraries like jQuery to make the same code work the same on all browsers.
Pro No compile time in development
Dartium (Chromium derivative) is a browser with integrated Dart VM, which allows you to run and debug native Dart code during development for short edit-reload cycles. Only for testing on other browsers and deployment is transpiling to JS necessary.
Pro Easy prototyping
Dart has an optional type system which makes Dart a great language for prototyping. It encourages developers to gradually evolve their programs without worrying about types first.
Pro Can compile to efficient machine code
Dart was designed to be as expressive as possible. Ahead-of-time compilers can compile Dart code to efficient machine code. This is especially important when deploying to mobile where you don't want (or can't) use a JIT.
Pro Optional strong mode.
Strong mode applies a more restrictive type system to Dart to address its unsound, surprising behavior in certain cases.
Pro AngularDart 2.0 support
Pro Support of semi-coroutines (generators)
Generators, also known as semicoroutines, are also a generalization of subroutines.
Generators are primarily used to simplify the control of iteration behavior of a loop, the
yield statement in a generator passes a value back to a parent routine.
A generator is very similar to a function that returns an array, in that a generator has a certain number of values. But instead of building and returning an array that contains all the wanted values, a generator returns them one at a time, this saves memory and allows the caller function to start processing the first few values immediately.
Pro Strong static typing, null safe and flexible, almost dynamic type system
The compiler prevents you from using a potentially null variable, unless you check it is not null. Ie. it forces you to check a potentially null value before using it.
The type system is strict, but flexible, allowing union and intersection of types, covariant and contravariant types, reified types, etc.
Type inference and union types allows a dynamic programming style, close of JS spirit.
It brings type safety to JS, allowing to define interfaces to existing JS APIs, yet using the
dynamic keyword for flexible calls in the JS ecosystem.
Pro Excellent IDE support
Ceylon has reified generics, so it doesn't loose the type of collections at runtime. This makes autocompletion, debugging, etc. first-class. The Eclipse plugin makes it a full-fledged Ceylon IDE, and an IntelliJ IDEA plugin is in the works.
Pro Great tutorial
Gavin King, main author of the language, has a great, clear technical writing style, making understandable difficult concepts like variance or sound type system.
Pro Try it out in the browser
It has a Web IDE: http://try.ceylon-lang.org/ with impressive demos: http://try.ceylon-lang.org/?gist=bd41b47f325b6d32514a so you can try it without installing anything, and see the JS generation / interop in action.
Pro Excellent documentation
The language specification is very complete and up to date; also, the language module is very well documented.
Pro Easy to learn even if you don't have prior programming experience
Ceylon is indeed fairly easy and readable. Of course those ones who know OOP and a bit of functional programming concepts will feel almost at home right from the start.
Pro Generate HTML
HTML generation is supported right in the SDK.
Pro Same code in backend and frontend
Con Small community, little momentum
Con Dart SDK does not provide standard (out of the box) way to access SQL-based databases on server side
This missing (but very popular) feature requires to use 3rd-party packages developed by the personal enthusiasts or very small groups of enthusiasts, which is not very convenient because they are all very fragmented in terms of content, the essence and capabilities.
Con Currently has large runtime
Ceylon 1.2 needs a language runtime of 1.55 MiB, and the Collection library adds another 370 KiB. That's a lot for the Web...
Now, this has to be put in perspective: if you use Ceylon to make a web application, these files will be loaded once, then cached by the browser (that's not casual browsing).
Moreover, most servers compress such resource, and the numbers become respectively 234 KiB and 54 KiB, which is more reasonable...
Con Lack of physical or electronic books
We should hope Red Hat or anyone interested would take the time and write one. That would strengthen the maturity of the language, but Ceylon is rapidly developing which can make the author's efforts futile because his or hers work will become obsolete soon.
The second hindrance is, of course, popularity of the language which can't give much to the pockets of the author (however, Dart's unpopularity at start didn't prevent it to have a lot of printed material, but that's Google's child, we know).