Skip to content

Instantly share code, notes, and snippets.

@ElectricCoffee
Last active August 29, 2015 14:00
Show Gist options
  • Save ElectricCoffee/ce8808dd08920749d07f to your computer and use it in GitHub Desktop.
Save ElectricCoffee/ce8808dd08920749d07f to your computer and use it in GitHub Desktop.
A language concept that uses UML Class Diagram notation for the visibility and types, so + is public, - is private, # is protected, / is derived, _ is static, and ~ is a package. It's indentation based like Python and F#, and a block starts with a =. The only difference between a variable a class and a method, is that classes have members and me…
~ com.wausoft.test =
+ _ Program =
+ main(args: Array[String]): Unit = // unit is equivalent to void
printfn("this is a test")
- res = add(2, 4) // type inferred to int
printfn("result: $res") // example of string interpolation
+ add(a: Int, b: Int): Int = a + b
+ Person =
- name = "" // type inferred to string
- age = 0 // type inferred to int
+ init(nm: String, ag = Int): Person =
name = nm
age = ag
+ birthday(): Unit = age += 1
+ new_name(nm: String): Person = new Person(nm, age)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment