Gosu is a statically typed programming language that runs on the Java virtual machine. This language is used in several open source projects SparkGS and Ragnar DB, and is widely used in the insurance industry in commercial products by Guidewire Software. The language incorporates the capabilities of the Java , C # and ECMAScript languages. A unique feature of the language is its open type system, which makes it easy to provide verification at compile time or in the IDE. The language also allows you to create both general-purpose programs (.gst files) and scripts (.gsp files) and execute them directly from the source without prior compilation.
| Gosu | |
|---|---|
| Language class | and |
| Appeared in | |
| Author | Guidewire software |
| Developer | Guidewire and open source contributors |
| Release | 1.14.6 ( April 5, 2017 ) |
| Type system | Static |
| Influenced | and |
| Influenced | Kotlin |
| License | Apache license |
| Platform | Runs on Java Virtual Machine , statically and dynamically compiled into Java bytecode. |
| OS | JVM support |
| Site | gosu-lang.org |
Syntax
Gosu has C-style syntax.
The simplest Hello World program on Gosu.
class Main { static function main ( args : String []) { print ( "Hello, World!" ) // or simply "Hello, World!" . print () } } // the second option only works if enhancement MyStringEnhancement is added : String { function print () { print ( this ) } } Using methods and lambdas it is very easy to work with container objects.
var list = { 1 , 2 , 3 }
var result = list . where (\ elem -> elem > = 2 )
print ( result )
Gosu classes can have functions, fields, properties, and inner classes as members. Nominal inheritance and composition through delegation are built into the type system as well as structural typing. In addition to the standard class types, Gosu supports enumerations, interfaces, structures, and annotations.