When comparing Ceylon vs Web Components, the Slant community recommends Ceylon for most people. In the question“What are the best solutions to "The JavaScript Problem"?” Ceylon is ranked 12th while Web Components is ranked 29th. The most important reason people chose Ceylon is:
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.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
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 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.
Pro Designed from the start to generate JavaScript
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 Excellent documentation
The language specification is very complete and up to date; also, the language module is very well documented.
Pro Javascript interoperability
Ceylon has special language-level support for interoperation with dynamically typed languages like JavaScript, and its module system even interoperates with npm.
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
If you don't use platform-specific features, you can reuse the same code in your backend server (be it in Java or JavaScript) and in your client-side browser code, for example for storing data, validating input etc.
Pro Great for small—likely published—reusable libraries
Very extendable as a single-import base layer for visual controls and probably also something like a react-redux Provider.
Pro Works with any framework
Less recreation of the wheel and fewer wrappers.
Pro Fallback styling when not yet defined
Before a component's script defines the custom element—either as the page is loading or with JavaScript disabled—it can be temporarily styled via :not(:defined)
. This may prevent the need for SSR.
Pro Customizable templates via custom-recognized "slots"
slot="name"
and <slot name="name">
for customizing a component's HTML in specific areas of its shadow DOM. Also fallbacks when not defined.
Pro Stylable via custom-exposed "parts"
::part(name)
pseudo-element for styling elements within a component's shadow DOM.
Cons
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).
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 Not well-suited for application wiring
Having to serialize/deserialize data between components is not convenient. You'll probably still need a [light/simple] framework. Some things are still quite nice, such as using the light DOM -- think <option>
with <select>
and <datalist>
.
Con SSR is potentially more difficult
…if you need more than CSS' :not(:defined)
, that is.
Check out this video to see how the creator of SkateJS handled it: https://www.youtube.com/watch?v=yT-EsESAmgA