Ceylon (programming language): Difference between revisions

Content deleted Content added
CPColin (talk | contribs)
mNo edit summary
Mrhaandi (talk | contribs)
m Type system: referenced intersection type
Line 87:
One of the most novel aspects of Ceylon is its [[type system]]. Ceylon foregoes Java's primitive types<ref>{{cite web|last1=King|first1=Gavin|title=Ceylon: Language Design FAQ|url=http://ceylon-lang.org/documentation/faq/language-design/}}</ref> and [[Object type|boxing]] in favor of a type system composed entirely of first-class objects. While this may cause boxing overhead in some situations, it makes the type system more uniform.
 
Ceylon allows for union and [[intersection typestype]]s, in a similar fashion to [[TypeScript]], [[Whiley (programming language)|Whiley]] and Flow.
 
Union types, written <code>A|B</code>, allow a variable to have more than one type. The following example shows a Ceylon function which may take either an [[Integer (computer science)|integer]] or a [[String (computer science)|string]]: