Gosu (programming language)

Gosu is a statically-typed general-purpose programming language that runs on the Java Virtual Machine. Its influences include Java, C#, and ECMAScript. Development of Gosu began in 2002 internally for Guidewire Software, and the language saw its first community release in 2010 under the Apache 2 license.[1]

DeveloperGuidewire and open source contributors
Stable release
1.14.6 / April 5, 2017 (2017-04-05)
Typing disciplinestatic
PlatformExecute on the Java Virtual Machine, statically and dynamically compiles to bytecode
OSany supporting JVM
LicenseApache License 2.0
Filename extensions.gs, .gsp, .gst, .gsx
Influenced by
Java, C#

Gosu can serve as a scripting language, having free-form Program types (.gsp files) for scripting as well as statically verified Template files (.gst files). Gosu can optionally execute these and all other types directly from source without precompilation, which also distinguishes it from other static languages.


Gosu began in 2002 as a scripting language called GScript at Guidewire Software. It was used to configure business logic in Guidewire's applications and was more of a simple rule definition language. In its original incarnation it followed ECMAScript guidelines. Guidewire enhanced the scripting language over the next 8 years, and released Gosu 0.7 beta to the community in November 2010. The 0.8 beta was released in December 2010, and 0.8.6 beta was released in mid-2011 with additional typeloaders, making Gosu capable of loading XML schema definition files and XML documents as native Gosu types. The latest version is 1.10, released in January 2016, along with a new IntelliJ IDEA editor plugin.


Gosu language creator and development lead, Scott McKinney, emphasizes pragmatism as the overriding principle in Gosu's design.[2] For instance, code readability won out in design contests between readability and concision.[3] This emphasis was partially due to McKinney's need for a web template system; and Gosu's is influenced by that of Velocity and JavaServer Pages. XML Schema Definitions are also heavily integrated into the language, as well as object-relational mappings, because of the business requirements into which Gosu was born.

Discoverability is also a key principle that guides the language's design. As such Gosu's rich static type system is a necessary ingredient toward best of breed tooling via static programming analysis, rich parser feedback, code completion, deterministic refactoring, usage analysis, navigation, and the like. To that end the Gosu team is highly involved in both language and tooling/IDE design.

Syntax and semantics

Gosu follows a syntax resembling a combination of other languages. For instance, declarations follow more along the lines of Pascal with name-first grammar. Gosu classes can have functions, fields, properties, and inner classes as members. Nominal inheritance and composition via delegation are built into the type system as well as structural typing similar to the Go programming language.

Gosu supports several file types:

  • Class (.gs files)
  • Program (.gsp files)
  • Enhancement (*.gsx files)
  • Template (*.gst files)

In addition to standard class types Gosu supports enums, interfaces, structures, and annotations.

Program files facilitate Gosu as a scripting language. For example, Gosu's Hello, World! is a simple one-line program:

print("Hello, World!")

Gosu classes are also executable a la Java:

class Main {
  static function main(args: String[]) {
    print("Hello, World!")

Data types

A unique feature of Gosu is its Open Type System, which allows the language to be easily extended to provide compile-time checking and IDE awareness of information that is typically checked only at runtime in most other languages. Enhancements let you add additional functions and properties to other types, including built-in Java types such as String, List, etc. This example demonstrates adding a print() function to java.lang.String.

enhancement MyStringEnhancement : String {
  function print() {

Now you can tell a String to print itself:


The combination of closures and enhancements provide a powerful way of coding with Collections. The overhead of Java streams is unnecessary with Gosu:

var list = {1, 2, 3}
var result = list.where(\ elem -> elem >= 2)


This general-purpose programming language is used primarily in Guidewire Software's commercial products.


  1. "Gosu Programming Language Released To Public". Slashdot. 2010-11-09.
  2. "Language of the Month: Gosu". Dr. Dobb's Journal. 2012-12-07.
  3. "The five "Next Big Things" in open source". Software Development Times. 2010-12-09. Retrieved 2018-09-11.

Further reading

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.