Hubbry Logo
Gosu (programming language)Gosu (programming language)Main
Open search
Gosu (programming language)
Community hub
Gosu (programming language)
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Gosu (programming language)
Gosu (programming language)
from Wikipedia
Gosu
DeveloperGuidewire and open source contributors
Stable release
1.18.6[1] Edit this on Wikidata / 28 June 2025; 4 months ago (28 June 2025)
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
Websitegosu-lang.github.io
Influenced by
Java, C#
Influenced
Kotlin

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.[2]

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.

History

[edit]

Gosu is often described as a Java variant that introduces practical improvements while maintaining compatibility and interoperability with Java. The language originated in 2002 at Guidewire Software, where it was initially known as GScript, a scripting language designed for use within Guidewire applications.[3][4] As GScript evolved from a simple scripting tool into a general-purpose programming language, it was renamed Gosu by its lead developer, Scott McKinney.

Originally created as a “glue language” to allow Guidewire customers to define business rules, Gosu quickly found broader use within the company’s products, supporting areas such as user interface bindings, templating, and document management. Over time, Gosu became the primary implementation language across Guidewire’s application suite, surpassing Java in overall usage.

Guidewire released Gosu 0.7 beta to the public in November 2010, followed by 0.8 beta in December 2010 and 0.8.6 beta in mid-2011. These releases introduced several enhancements, including new typeloaders that allowed Gosu to dynamically represent external data formats such as JSON and XML as native Gosu types.

Guidewire continues to use and support Gosu extensively within its InsuranceSuite applications. While active development of new Gosu language features has been paused, the company continues to expand InsuranceSuite through RESTful APIs and integration frameworks accessible from both Gosu and Java.

Philosophy

[edit]

Gosu language creator and development lead, Scott McKinney, emphasizes pragmatism, found in readability and discoverability, as the overriding principle that guides the language's design.[5] For instance, Gosu's rich static type system is a necessary ingredient toward best of breed tooling via static program analysis, rich parser feedback, code completion, deterministic refactoring, usage analysis, navigation, and the like.

Syntax and semantics

[edit]

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

[edit]

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() {
    print(this)
  }
}

Now you can tell a String to print itself:

"Echo".print()

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)
print(result)

Uses

[edit]

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

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Gosu is an open-source, statically typed, that runs on the (JVM). Developed by since 2002, it originated as a rule expression language and evolved into a full-featured object-oriented language designed for building configurable business applications, particularly in the property and casualty (P&C) sector. Gosu is used in over 700 P&C core system implementations worldwide, as well as in hundreds of third-party applications, supporting tens of thousands of developers and consultants. Key to Gosu's design is its seamless interoperability with , allowing developers to leverage existing Java libraries and types while benefiting from JVM performance and ecosystem tools. It incorporates productivity-enhancing features such as advanced , structural typing, extension methods (known as enhancements), reified generics with declaration-site variance, lambda expressions, null safety, and named arguments with default values. The language's open enables pluggable custom types, including support for XML/XSD schemas, web services, with dynamic typing, and transactions for database integrity. These elements make Gosu particularly suited for domain-specific configurations like rules, workflows, and user interfaces in . Gosu's syntax emphasizes readability and conciseness, supporting program files that mix statements, functions, and classes without , along with string templates and object initializers. It provides full IDE support through plugins for and , featuring , , refactoring, and debugging. While primarily associated with Guidewire's InsuranceSuite platform, Gosu's open-source nature under the allows its adoption beyond for any JVM-based development.

History

Origins and Early Development

Gosu originated in 2002 at , a company specializing in property and software, where it was initially developed as GScript, a domain-specific designed to implement business rules within applications. The primary motivation was to provide an embeddable, statically typed scripting solution that could handle complex configurations in Guidewire's stack, addressing limitations in existing languages for tasks like rule evaluation and subsystem customization. From its inception, GScript was deployed internally within Guidewire's InsuranceSuite product, a suite of applications including PolicyCenter, BillingCenter, and ClaimCenter, where it facilitated rule-based configurations for , claims processing, and billing logic. This early use emphasized its role in enabling non-developer users, such as business analysts, to define and modify application behaviors without altering core code, while leveraging the (JVM) for performance and interoperability. Over the subsequent years, the language evolved from a narrow scripting tool into a general-purpose, statically typed programming language, incorporating advanced features like and an open to support broader JVM-based development. Key early development was led by Scott McKinney, Guidewire's principal language designer, along with a team of engineers focused on enhancing static typing for reliable tooling and capabilities. Around 2010, as the language's scope expanded beyond scripting, it was renamed to better reflect its general-purpose nature and growing applicability outside domain-specific insurance tasks. In 2013, Guidewire transitioned to open-source status under the 2.0, making its codebase publicly available to foster community contributions and wider adoption.

Public Release and Evolution

Guidewire released the first public beta of , version 0.7, in November 2010, marking the language's initial availability beyond internal use. This was followed by version 0.8 beta in December 2010 and version 0.8.6 beta in mid-2011, which introduced enhancements such as improved type loaders for better . Earlier that year, in July 2010, Guidewire presented at the JVM Language Summit, showcasing its early capabilities for dynamic code evolution and hot-swapping support on the JVM. In August 2013, Gosu was officially open-sourced under the 2.0 with the release of version 0.10.2, enabling community contributions through its repository. Subsequent versions, such as 1.0 in July 2014 and 1.3 in November 2014, incorporated community feedback and expanded Java interoperability. As of November 2025, the latest stable release is version 1.18.6. Guidewire continues to support for enterprise applications, with recent enhancements such as the 2025 Niseko release introducing an AI-powered developer assistant to accelerate development.

Philosophy and Design Goals

Core Principles

's design embodies , prioritizing practical utility and developer productivity over theoretical purity in language construction. Developed to enhance efficiency within enterprise environments, particularly for property and applications, focuses on delivering tangible improvements for developers by streamlining common tasks while preserving the robustness of the (JVM) ecosystem. This approach ensures that the language remains accessible and effective for real-world use cases, avoiding overly complex abstractions that could hinder adoption. A key principle is the emphasis on readability, achieved through intuitive, natural-language elements and discoverable application programming interfaces (APIs). By incorporating English-like Boolean operators such as "and," "or," and "not," along with features like object initializers, Gosu promotes code that is easier to understand and maintain, reducing cognitive load for developers working on large-scale projects. This design choice fosters clearer expression of intent, making the language suitable for collaborative teams where code review and long-term maintainability are critical. The language's rich static forms another foundational tenet, enabling advanced (IDE) tooling such as , refactoring, and error detection at . Gosu incorporates , generics, structural typing, and null safety mechanisms to balance expressiveness with safety, allowing developers to write concise yet reliable code without sacrificing compile-time checks. To address Java's verbosity, Gosu aims to minimize while upholding , introducing constructs like blocks (closures and expressions) and default parameters that eliminate repetitive patterns common in traditional development. This reduction in ceremony enhances productivity without compromising the language's static typing guarantees, enabling faster iteration in complex applications. Central to Gosu's extensibility principle is the concept of "enhancements," which allows developers to extend existing types—particularly classes—with new functions and properties without relying on inheritance hierarchies. This mechanism promotes modular code augmentation, improving reusability and integration with legacy libraries by adding domain-specific behaviors directly to base types.

Influences and Comparisons

Gosu's design draws heavily from several established programming languages, particularly for its JVM compatibility and object-oriented structure, C# for features like and delegates, and for scripting flexibility. These influences enable Gosu to maintain seamless interoperability with Java ecosystems while incorporating more expressive constructs to enhance developer productivity. For instance, in Gosu simplify access to object fields in a manner akin to C#, reducing boilerplate compared to Java's getter and setter methods. In comparisons to contemporaries, Gosu is more concise than , offering , closures, and extensions that streamline code without sacrificing static typing, though it predates Java's adoption of some similar features in later versions. Relative to , another JVM , Gosu enforces stricter static typing, providing better IDE support and error detection at , which addresses maintainability issues in large-scale dynamic codebases. Unlike Java's purely nominal typing, Gosu supports structural typing, allowing types to be compatible based on shared characteristics rather than explicit declarations, facilitating flexible integrations with external data formats like XML or . A distinctive aspect of is its blend of static typing with dynamic-like enhancements, such as an open that programmatically extends types for better in enterprise environments. This design specifically targets pain points in for enterprise scripting, including verbose syntax for common operations and limited support for embedding configuration logic, by unifying data sources as first-class types with full tooling integration.

Syntax and Features

Basic Syntax

Gosu source files use specific extensions to denote their purpose: .gs for class files, .gsp for script files that can be executed directly, .gsx for enhancement files, and .gst for template files. A basic program in a .gsp file consists of executable statements that run immediately upon invocation, without requiring a class wrapper. For example, the following script prints a greeting:

gosu

print("Hello, World!")

print("Hello, World!")

This structure allows for quick prototyping and scripting tasks. Classes in are declared using the class keyword, followed by the class name and a body enclosed in curly braces. Methods within the class are defined with the function keyword, and constructors use the construct keyword. A simple class example is:

gosu

class MyClass { construct() { // Initialization code } function myMethod(param : String) : void { print("Processing: " + param) } }

class MyClass { construct() { // Initialization code } function myMethod(param : String) : void { print("Processing: " + param) } }

This syntax supports with familiar block delimitation. Properties in Gosu provide a way to encapsulate fields with and logic, declared using the property keyword. For read-only or computed properties, only a get clause is needed; setters can include validation. An example of a with custom accessors is:

gosu

class Example { private var _value : [String](/page/String) [property](/page/Property) get MyProp() : [String](/page/String) { return _value } [property](/page/Property) set MyProp(newValue : [String](/page/String)) { if (newValue != null) { _value = newValue } } }

class Example { private var _value : [String](/page/String) [property](/page/Property) get MyProp() : [String](/page/String) { return _value } [property](/page/Property) set MyProp(newValue : [String](/page/String)) { if (newValue != null) { _value = newValue } } }

Simple properties can also be backed by var declarations with the as keyword for automatic accessors. Gosu includes standard control structures for conditional and iterative logic, using curly braces to delimit blocks regardless of indentation. The if statement supports chaining with else if and else, as in:

gosu

if (condition) { // True branch } else if (anotherCondition) { // Alternative branch } else { // Default branch }

if (condition) { // True branch } else if (anotherCondition) { // Alternative branch } else { // Default branch }

For loops iterate over collections, arrays, or ranges, with optional index tracking:

gosu

var numbers = {1, 2, 3} for (num in numbers) { print(num) } for (i in 0..5) { print(i) // Prints 0 to 5 inclusive }

var numbers = {1, 2, 3} for (num in numbers) { print(num) } for (i in 0..5) { print(i) // Prints 0 to 5 inclusive }

While loops execute a block repeatedly based on a condition:

gosu

var count = 0 while (count < 5) { print(count) count++ }

var count = 0 while (count < 5) { print(count) count++ }

These structures resemble those in Java but incorporate enhancements like keyword alternatives (and, or) for readability in conditionals.

Type System

Gosu employs a static type system that ensures compile-time type safety while leveraging advanced type inference to minimize explicit type annotations in code. This approach allows developers to declare variables using the var keyword, where the compiler infers the type from the initializer expression; for instance, var count = 42 infers int, and var message = "Hello" infers String. Such inference reduces boilerplate compared to languages like Java, promoting readable code without sacrificing the benefits of static checking. The language supports a set of primitive data types aligned with JVM primitives, including int for 32-bit signed integers, double for 64-bit IEEE 754 floating-point numbers, boolean for true/false values, and String for immutable sequences of characters. Literals for these types include decimal integers (e.g., 42 for int), decimal floats (e.g., 3.14 for double), true or false for boolean, and quoted strings (e.g., "text" or 'text' for String, with support for escape sequences like \'). Behaviors mirror JVM semantics: arithmetic operations on int and double follow standard rules with potential overflow for integers unless using checked modes, boolean supports logical operators like && and ||, and String enables concatenation via + and interpolation with ${expression}. These primitives integrate seamlessly with Gosu's object-oriented model, allowing autoboxing to wrapper classes like Integer when needed. Gosu primarily uses nominal typing, where type compatibility is determined by declared names and inheritance hierarchies, but it incorporates structural typing to allow compatibility based on shape—specifically, the presence of matching properties and methods—rather than nominal declaration. This is achieved through the structure keyword, which defines an anonymous interface-like type; for example, structure Coordinate { property get X(): double property get Y(): double } enables any type with compatible X and Y getters (e.g., a Point class) to be treated as a Coordinate without explicit implementation. At runtime, structural types are erased to Object and implemented via dynamic proxies for invocation, supporting contravariant parameters and covariant returns, including primitive widening like int to double. This feature facilitates flexible APIs, such as sorting heterogeneous objects by common properties, while maintaining static type safety. The Open Type System (OTS) extends Gosu's type system at runtime, allowing custom type loaders to inject dynamic types—such as those derived from XML schemas or databases—into the compile-time model for safe structural operations. Implementing the ITypeLoader interface, OTS resolves type names to IType objects, providing metadata like MethodInfo and PropertyInfo for reflection and type checking without requiring bytecode generation for all types. This enables seamless integration of dynamic data sources, ensuring compile-time awareness and IDE support for operations on non-Gosu types, such as validating XML against XSD-derived structures. To address null-related errors common in JVM languages, Gosu incorporates null safety features including the safe navigation operator ?. for conditional invocation (e.g., obj?.method() returns null if obj is null instead of throwing an exception) and the Elvis operator ?: for default values (e.g., value ?: "default"). These operators promote defensive programming by preventing NullPointerException at runtime while preserving type inference; return types adjust to nullable where necessary. Although Gosu lacks a dedicated Optional type like Java's, these mechanisms provide optional-like handling, enforcing explicit null consideration in code.

Advanced Constructs

Gosu supports closures and lambda expressions, known as blocks, which enable functional programming paradigms by allowing anonymous functions to be defined inline. These blocks use the syntax \ parameter -> expression, where type inference often eliminates explicit declarations. For instance, a common usage filters a list of strings: listOfStrings.where(\ s -> s.length() > 2), which returns strings longer than two characters, making more concise than equivalent code. This feature captures variables from the enclosing scope, supporting true closures with on return types and contravariance on parameters. Enhancements provide a mechanism to extend existing Java classes or interfaces at compile time by adding methods and properties without modifying the original source, defined in .gsx files using the enhancement keyword. For example, to add a method to the String class:

enhancement StringEnhancement : String { function printWarning() { print("WARNING: " + this) } }

enhancement StringEnhancement : String { function printWarning() { print("WARNING: " + this) } }

This allows invocation as "alert".printWarning(), with static dispatch ensuring performance comparable to native methods. Enhancements support generics, such as extending List<T> with a custom each function that iterates over elements, and they promote code reuse in enterprise applications by enabling domain-specific extensions to standard library types. Unlike runtime monkey patching, enhancements are verified statically and do not introduce state or fields. Exception handling in Gosu integrates seamlessly with the JVM's exception model, using standard try-catch-finally blocks without checked exceptions, which simplifies code compared to . Developers can catch specific exceptions like IOException or general Throwable, with guidelines emphasizing narrow catches to avoid masking errors. For resource management, the using statement automatically disposes of objects implementing AutoCloseable, equivalent to a try-with-resources block: using (var input = new FileInputStream("file.txt")) { /* use input */ }, ensuring cleanup even if exceptions occur. The template system in uses .gst files for code generation and dynamic content rendering, blending with embedded expressions in a JSP-like syntax. A basic template might declare parameters and iterate:

<%@ params names : String[] %> All Names: <% for (name in names) { %> * ${name} <% } %>

<%@ params names : String[] %> All Names: <% for (name in names) { %> * ${name} <% } %>

Rendered via methods like MyTemplate.renderToString(names), it produces formatted output suitable for reports or web pages in enterprise scenarios. Templates are statically verified, supporting type-safe interpolation with ${expression} and control structures, enhancing productivity in configuration-driven applications.

Uses and Ecosystem

Primary Applications

Gosu serves as the foundational programming language for Guidewire's InsuranceSuite, a comprehensive platform for property and casualty (P&C) insurance operations. It powers core functionalities such as policy administration, where developers define and manage policy lifecycles, including issuance, renewals, and endorsements; claims processing, enabling automated adjudication and settlement workflows; and business rules, which govern validation, routing, and decision-making logic across the suite. This integration allows InsuranceSuite to handle over 1,700 successful implementations worldwide, supporting tens of thousands of developers in building and maintaining enterprise-scale insurance systems. In the insurance sector, has seen significant adoption for configuring complex workflows, permitting insurers to tailor business processes—such as approvals and claims —without recompiling or modifying the underlying core code. This configuration-driven approach leverages 's type-safe scripting to extend base functionality through enhancements, rules, and integrations, reducing deployment risks and accelerating customization for specific regulatory or operational needs. Representative use cases include dynamic rule engines for real-time eligibility checks in quoting, transformation scripts for mapping legacy system to InsuranceSuite entities during migrations, and UI enhancements via extensions that customize screens for user-specific views without altering the platform's . While Gosu's primary footprint remains niche within the P&C insurance domain due to its tight coupling with Guidewire products, open-source interest has grown since 2020, evidenced by active community contributions on and expanded tooling support like VS Code extensions. As of 2025, remains integral to Guidewire's cloud-based offerings, including the Niseko release, where it preserves configurations during migrations to cloud environments and supports scalable, SaaS-deployed insurance solutions.

Tooling and Integration

Gosu provides seamless integration with the (JVM), enabling full access to Java libraries and frameworks without additional bridging mechanisms. Developers can directly import and utilize Java classes, extend Java types, and implement Java interfaces from Gosu code, leveraging the language's static typing and for smooth . Additionally, Gosu compiles dynamically to JVM at runtime, allowing for efficient execution alongside Java components in mixed-language projects. The official integrated development environment (IDE) for Gosu is Guidewire Studio, which is built as extensions to the IntelliJ IDEA Community Edition, providing robust support for syntax highlighting, code completion, debugging, and refactoring tailored to Gosu's features. This IDE facilitates efficient development of Gosu applications, particularly within Guidewire's ecosystem, by integrating language-specific inspections and tools directly into the workflow. For open-source Gosu development, community-maintained plugins extend support to IntelliJ IDEA, offering similar functionalities like error detection and navigation. Gosu projects are compatible with standard Java build tools, including Maven and , enabling straightforward management of mixed Java-Gosu codebases. The Gosu plugin, for instance, adds dedicated tasks for compiling Gosu sources (e.g., compileGosu and compileTestGosu), integrating seamlessly with Gradle's dependency resolution without requiring a local Gosu installation. Similarly, Maven configurations allow Gosu compilation through plugins that handle artifact resolution from repositories like Maven Central, supporting hybrid projects where Gosu and Java sources coexist. These tools ensure that Gosu fits into established JVM build pipelines, reducing setup overhead for teams transitioning from pure Java environments. The Gosu community maintains an active GitHub organization at gosu-lang, where the primary repository (gosu-lang/gosu-lang) hosts the language's source code, build instructions, and contributions from developers. Official documentation is available at gosu-lang.github.io, covering quickstarts, grammar specifications, and advanced topics to aid adoption and extension of the language. In 2025, Gosu received updates to support modern JVM versions, including Java 21, as part of Guidewire's InsuranceSuite platform release in September, which mandates Java 21 for compatibility and performance enhancements in enterprise deployments. These updates address compatibility gaps while focusing on stability and integration reliability. The Niseko release also introduced an early access AI-powered developer assistant for Gosu, which speeds up development through intelligent code generation, explanations, and testing based on natural language prompts.

References

  1. https://www.wikidata.org/wiki/Q5587589
Add your contribution
Related Hubs
User Avatar
No comments yet.