Dart backend for Ceylon
Developer preview release 4 (DP4) of the Dart backend for Ceylon is now available
This release is compatable with Ceylon 1.3.2 and contains several bug fixes and enhancements over DP3.
Developer preview release 3 (DP3) of the Dart backend for Ceylon is now available
This release is compatable with Ceylon 1.3.0 and contains several bug fixes and enhancements over DP2.
Developer preview release 2 (DP2) of the Dart backend for Ceylon is now available
This release includes:
- Complete support for the Ceylon 1.2.2 language, except reified generics and the metamodel.
- A familiar CLI for compiling and running Ceylon programs (
- A powerful application assembly tool (
- Eleven Ceylon SDK modules
- Initial support for Dart interop, including async/await, the
ceylon.interop.dartmodule, and the ability to import and use 11 native Dart modules such as
Installing the Dart backend for Ceylon
The commandline interface for the Dart backend is available on [Ceylon Herd] (https://modules.ceylon-lang.org/modules/com.vasileff.ceylon.dart.cli), and can be easily installed on any OS X or Linux system.
Step 1: Install Ceylon
To install Ceylon, see http://ceylon-lang.org/download/. Ceylon 1.3.2 is required.
Step 2: Install Dart
$ brew tap dart-lang/dart $ brew install dart
For Linux users, Dart is available as either a Debian package or zip download from https://www.dartlang.org/downloads/.
Step 3: Install the Ceylon/Dart CLI Plugin
The commandline interface can be installed with:
$ ceylon plugin install --force com.vasileff.ceylon.dart.cli/1.3.2-DP4
ceylon compile-dart or
ceylon run-dart for the first time, you
will be prompted to complete the installation by running:
$ ceylon install-dart --out +USER
This will install the Ceylon language module, several Ceylon SDK modules, and
several Dart interop modules into your local Ceylon module repository, which,
for default Ceylon installations, is located at
And that's it!
Please note that upon running the commandline tools the first time, additional dependencies may be downloaded. No feedback is provided that this is happening, and canceling early may result in a corrupted download. So please be patient!
Using the Commandline Interface
ceylon compile-dartto compile Ceylon modules to Dart
ceylon run-dartto run compiled Ceylon modules on the Dart VM
A third tool,
ceylon assemble-dart, package a Ceylon module as a standalone
executable for the Dart VM.
Ok, it's installed, what do I do now?
There are three main types of applications that can be written today:
- command line applications,
- server side applications using
Support for pure-Ceylon CLI applications is quite advanced and supports nearly all valid Ceylon 1.3.2 programs. Modules can be compiled, run, and even imported using standard Ceylon tools and conventions. See the "Hello, World" walkthrough below to get started.
Check back soon for more on building server and web applications. For now, you
might want to check out
ColorTrompon, which is a Ceylon
syntax highligher, written in Ceylon, compiled with
ceylon compile-dart colortrompon, and
ceylon assemble-dart mode=js colortrompon.
"Hello, World" Walkthrough
If you're new to Ceylon, you can perform the following steps to compile and run your first program.
First, use the
ceylon new command to create an initial project structure:
$ ceylon new hello-world Enter project folder name [helloworld]: Enter module name [com.example.helloworld]: Enter module version [1.0.0]: Would you like to generate Eclipse project files? (y/n) [y]: Enter Eclipse project name [com.example.helloworld]: Would you like to generate an ant build.xml? (y/n) [y]: $ cd helloworld/
In the newly created helloworld directory, you will find
source/com/example/helloworld containing the main
run.ceylon source code
package.ceylon module and package descriptors.
Now, from within the
helloworld directory, the program can be compiled with:
$ ceylon compile-dart Note: Created module com.example.helloworld/1.0.0
which creates a
modules directory, and places the Dart output in the file
Run the program with the
ceylon run command, specifying the module name and
$ ceylon run-dart com.example.helloworld 'Ceylon on Dart' Hello, Ceylon on Dart!
Or, if you like, create a single-file application:
$ ceylon assemble-dart --out helloworld com.example.helloworld Created executable Dart script helloworld
and run as you would any other executable:
$ ./helloworld 'Ceylon on Dart, without the Java!!' Hello, Ceylon on Dart, without the Java!!!
Of course, you'll want to write much more sophisticated programs that take advantage of Ceylon's advanced but easy to use type system and features. To learn more, see the Ceylon language tour.
You can also try Ceylon online, but be sure to copy the examples locally, and try them out on the Dart backend!
ceylon new Command
Note that the
ceylon new command is not Dart specific; it is a standard
command available with Ceylon 1.3.2. For help using the command, use
ceylon help new.
Also note that the first argument to
ceylon new must be the name of a
template. Of the three templates available as part of Ceylon 1.3.2,
simple can be used for Dart projects. For example, to get
started with a blank project, you might use:
ceylon new simple --module-name=com.mydomain.myproject myprojectDir
Ceylon/Dart DP2 Release Details
SDK Modules Included in DP2
Several Ceylon SDK modules ship with DP2:
ceylon.bufferallows you to convert between text and binary forms of data
ceylon.collectionprovides general-purpose mutable lists, sets, and maps
ceylon.htmlallows you to write HTML templates for both server and client using only Ceylon
ceylon.interop.darttypes and utilities to work with native Dart code and libraries,
ceylon.jsoncontains everything required to parse and serialise JSON data
ceylon.numericprovides common math functions for floats and integers
ceylon.promisesupport for promises loosely based upon the A+ specification
ceylon.randomprovides a pseudorandom number generator and extendable API
ceylon.testsimple framework to write repeatable tests
ceylon.timeis a date and time library library that is loosely inspired by the JodaTime/JSR-310 library
ceylon.wholeprovides arbitrary-precision integer numeric type
Dart Interop Modules Included in DP2
Several Dart modules can be imported by DP2 programs:
The content of this repository is released under the ASL v2.0 as provided in the LICENSE file that accompanied this code.
By submitting a "pull request" or otherwise contributing to this repository, you agree to license your contribution under the license mentioned above.