The Cyan Programming Language

mai 2013: there were some changes in the language. First, literal arrays are now delimited by {# and #} as in

     :v = {#  1, 2, 3 #};

More important, exceptions are thrown by sending message "throw: " to "self" with the exception as parameter:

         throw:  EmptyLineException;

A prototype example

package program 

private object Box
    private Int n = 0 
    fun get -> Int { 
        ^ self.n 
    fun set: Int n { 
        self.n = n 

object Program 
    public fun run {
        var s = Box clone; 
        var Int a; 
        a = In readInt; 
        s set: a; 
        Out writeln: (s get); 

Java-like Interfaces

interface Printable 
    fun print 

object Manager extends Person 
       implements Printable 
        // what he/she does 
    public var String profession 
    public fun print {

Hello World

package main

object Program
    public fun run {
        Out println: "Hello World"

Creating new objects

var Person person; 
    // the same as "person = new Person()" in Java 
person = Person new; 
    // cloning the Person object 
person = Person clone;
person = Person();