Ceylon is a new programming language for the JVM which was recently released on http://ceylon-lang.org with Eclipse based tooling available from day one.
This talk will introduce you to the goals and some of the features of the language while showing the features of the Eclipse based IDE.
Ceylon is a programming language for writing large programs in a team environment. The language is elegant, highly readable, extremely typesafe, and makes it easy to get things done. And it's easy to learn for programmers who are familiar with mainstream languages used in business computing. Ceylon has a full-featured Eclipse-based development environment, allowing developers to take best advantage of the powerful static type system. Programs written in Ceylon execute on the JVM.
Slides as they were used at EclipseCon 2012
Scanning the Internet for External Cloud Exposures via SSL Certs
Ceylon - the language and its tools
1. the language and its tools
Max Rydahl Andersen
Red Hat
http://about.me/maxandersen
EclipseCon 2012
2. About Me
• Max Rydahl Andersen
• Lead of JBoss Tools & Developer Studio
• Committer on Hibernate Core, Seam & Weld
• Co-host of JBoss Community Asylum Podcast
• @maxandersen on Twitter
• http://about.me/maxandersen
3. Ceylon Origins
• Created and lead by Gavin King
• Helped by others at JBoss
• Frustrated love for Java
• Lessons learned working in JCP
• Starting blocks
• on the JVM
• in the spirit of Java
• practical
• Slashdotted (with no web site)
15. Union Type
• To be able to hold values among a list of
types
• We must check the actual type before use
• `TypeA|TypeB`
• `Type?` is an alias for `Type|Nothing`
16. class Apple()
{ shared void eat() { print("Eat " this ""); }}
class Broccoli()
{ shared void throwAway() { print("Throw " this ""); } }
void unions() {
Sequence<Apple|Broccoli> plate =
{Apple(), Broccoli()};
for (Apple|Broccoli food in plate) {
print("Looking at: " food.string "");
if (is Apple food) {
food.eat();
} else if (is Broccoli food) {
food.throwAway();
}
}
}
25. Other features
• Interface based Operator overloading
• Closures
• Annotations
• Type aliases
• Meta-model
• Interception
• Interface with default implementations / “multiple inheritance”
• Declarative syntax for datastructures
• ...and more
27. Ceylon Today
• Website (http://ceylon-lang.org)
• Active and growing community
• Fully open source (http://github.com/ceylon)
• Targets JVM and JS (http://try.ceylon-lang.org)
• Milestone 2 just released
• Java interopability
• Full IDE support
29. Ceylon IDE
• Incremental compiler and error reporting
• Full editor with outline, folding and navigation
• Refactoring, Quick fixes, Search
• Wizards, Module repository integration
• Debugging
30. Ceylon IDE -
Behind the Scenes
• Considered XText, DLTK, IMP & “DIY”
• XText - very complete, but does not allow Antlr
and require XText custom parser and
typechecker
• DLTK - allows Antlr, but at the time no good
documentation and a preference to by “too
dynamic language focused”
• IMP - allows antlr and custom typechecker and
just worked, but..
31. Ceylon IDE -
Next Steps
• IMP has many limitations when you push it
• XText still too much “XText”
• DLTK looks interesting
• End result probably a mix of the above in a
“DIY” solution
• Contributors welcome!
33. ?
• http://try.ceylon-lang.org
• http://ceylon-lang.org
• http://ceylon.github.com/
Text
Text
bit.ly/ec12ceylon
Hinweis der Redaktion
\n
\n
JBoss: Emmanuel, Pete Muir, David Lloyd, Ales Justin, and more...\n\n\n
\n
simple class, should be nice and familiar.\nA few rules: classes always starts with a capital letter, and methods/attributes always starts with a lowercase letter.\n\nThe doc is a string/annotation to help \narea is a function using type inference.\n\nBut where is the constructor ?\n
constructor in the blocks\n\nThe area now have to be explicit about its type to avoid exposing too specific types.\n\nstarting to use shared for scope/visibility.\n\n\n
shared is the only scope modifier.\nmodule, package, class/methods\n\nshared are seen by those within my parent and outside if parent is shared too.\nYou can talk to the kids if you also can see the parents.\n\nTo be public you really need to mean it\n
To have mutable data you really need to mean it.\n
variable properties with values and methods (badArea)\n\n\n
class extends - parameters passed into the class constructor.\n
Ceylon is extremely regular - everything can be nested, allowing a lot more modularity than we are used to in java.\n
There is no way ceylon code can get an NPE. Its checked by the compiler and if you must you use if exists or the elvis operator ?.\n\n
One of the exotic but key features of Ceylon is its type system - it is after all a strongly typed language. \n\n
You are used to having a variable just having &#x201C;one type&#x201D; but in Ceylon they can actually be representing multiple types all at the same time.\n\n
Notice that I can call shared methods on union types - such as food.string.\nIf I tried to call food.eat() before it would not let me. \n
Here Guiness is both a food and drink and thus I can call both Food and Drink methods - but I can&#x2019;t assign just a Food.\n
\n
\n
\n
\n
Just one rectangle constructor/method - all handled with default parameters.\n\nYou can use named parameters too.\n
use type switch for handling visitor patterns and similar type based &#x2018;overloading&#x2019;\n\n\n\n\n