Recent from talks
Nothing was collected or created yet.
Gosu (programming language)
View on WikipediaThis article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
| Gosu | |
|---|---|
| Developer | Guidewire and open source contributors |
| Stable release | 1.18.6[1] |
| Typing discipline | static |
| Platform | Execute on the Java Virtual Machine, statically and dynamically compiles to bytecode |
| OS | any supporting JVM |
| License | Apache License 2.0 |
| Filename extensions | .gs, .gsp, .gst, .gsx |
| Website | gosu-lang |
| 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]- ^ "Release 1.18.6". 28 June 2025. Retrieved 16 July 2025.
- ^ "Gosu Programming Language Released To Public". Slashdot. 2010-11-09.
- ^ http://www.guidewire.com [bare URL]
- ^ https://gosu-lang.github.io/ [bare URL]
- ^ McKinney, Scott. "Language of the Month: Gosu". Dr. Dobb's Journal. Archived from the original on 18 December 2014.
Further reading
[edit]- McKinney, Scott (2010-07-26). "Introduction to Gosu" (PDF). JVM Language Summit 2010. Oracle.
- Gross, Carson (2011-07-18). "Language Features As A Library: Using Gosu's Open Type System With External DSLs" (PDF). JVM Language Summit 2011. Oracle. Video
External links
[edit]- Official website
- "Corporate website". Guidewire Software.
- gosu-lang on GitHub
Gosu (programming language)
View on GrokipediaHistory
Origins and Early Development
Gosu originated in 2002 at Guidewire Software, a company specializing in property and casualty insurance software, where it was initially developed as GScript, a domain-specific scripting language designed to implement business rules within insurance applications.[6] The primary motivation was to provide an embeddable, statically typed scripting solution that could handle complex configurations in Guidewire's enterprise software stack, addressing limitations in existing languages for tasks like rule evaluation and subsystem customization.[7] 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 underwriting, claims processing, and billing logic.[1] This early use emphasized its role in enabling non-developer users, such as business analysts, to define and modify application behaviors without altering core Java code, while leveraging the Java Virtual Machine (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 type inference and an open type system to support broader JVM-based development.[7] 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 metaprogramming capabilities.[8] Around 2010, as the language's scope expanded beyond scripting, it was renamed Gosu to better reflect its general-purpose nature and growing applicability outside domain-specific insurance tasks.[6] In 2013, Guidewire transitioned Gosu to open-source status under the Apache License 2.0, making its codebase publicly available to foster community contributions and wider adoption.[9]Public Release and Evolution
Guidewire released the first public beta of Gosu, version 0.7, in November 2010, marking the language's initial availability beyond internal use.[6] 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 interoperability.[10] Earlier that year, in July 2010, Guidewire presented Gosu at the JVM Language Summit, showcasing its early capabilities for dynamic code evolution and hot-swapping support on the JVM.[11] In August 2013, Gosu was officially open-sourced under the Apache License 2.0 with the release of version 0.10.2, enabling community contributions through its GitHub repository.[12][9] Subsequent versions, such as 1.0 in July 2014 and 1.3 in November 2014, incorporated community feedback and expanded Java interoperability.[13][14] As of November 2025, the latest stable release is version 1.18.6.[15] Guidewire continues to support Gosu for enterprise applications, with recent enhancements such as the 2025 Niseko release introducing an AI-powered developer assistant to accelerate Gosu development.[16]Philosophy and Design Goals
Core Principles
Gosu's design embodies pragmatism, prioritizing practical utility and developer productivity over theoretical purity in language construction. Developed to enhance software development efficiency within enterprise environments, particularly for property and casualty insurance applications, Gosu focuses on delivering tangible improvements for Java developers by streamlining common tasks while preserving the robustness of the Java Virtual Machine (JVM) ecosystem.[3][1] 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.[1] 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 type system forms another foundational tenet, enabling advanced integrated development environment (IDE) tooling such as code completion, refactoring, and error detection at compile time. Gosu incorporates type inference, 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.[3][1] To address Java's verbosity, Gosu aims to minimize boilerplate code while upholding type safety, introducing constructs like blocks (closures and lambda expressions) and default parameters that eliminate repetitive patterns common in traditional Java development. This reduction in ceremony enhances productivity without compromising the language's static typing guarantees, enabling faster iteration in complex applications.[3][1] Central to Gosu's extensibility principle is the concept of "enhancements," which allows developers to extend existing types—particularly Java classes—with new functions and properties without relying on inheritance hierarchies. This mechanism promotes modular code augmentation, improving reusability and integration with legacy Java libraries by adding domain-specific behaviors directly to base types.[3][1]Influences and Comparisons
Gosu's design draws heavily from several established programming languages, particularly Java for its JVM compatibility and object-oriented structure, C# for features like properties and delegates, and ECMAScript for scripting flexibility.[2] These influences enable Gosu to maintain seamless interoperability with Java ecosystems while incorporating more expressive constructs to enhance developer productivity. For instance, properties in Gosu simplify access to object fields in a manner akin to C#, reducing boilerplate compared to Java's getter and setter methods.[9] In comparisons to contemporaries, Gosu is more concise than Java, offering type inference, closures, and extensions that streamline code without sacrificing static typing, though it predates Java's adoption of some similar features in later versions.[17] Relative to Groovy, another JVM scripting language, Gosu enforces stricter static typing, providing better IDE support and error detection at compile time, which addresses maintainability issues in large-scale dynamic codebases.[6] 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 JSON.[1] A distinctive aspect of Gosu is its blend of static typing with dynamic-like enhancements, such as an open type system that programmatically extends types for better Java interoperability in enterprise environments.[17] This design specifically targets pain points in Java 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.[2]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.[18]
A basic Gosu 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:
print("Hello, World!")
print("Hello, World!")
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:
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)
}
}
property keyword. For read-only or computed properties, only a get clause is needed; setters can include validation. An example of a property with custom accessors is:
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
}
}
}
var declarations with the as keyword for automatic accessors.[18]
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:
if (condition) {
// True branch
} else if (anotherCondition) {
// Alternative branch
} else {
// Default branch
}
if (condition) {
// True branch
} else if (anotherCondition) {
// Alternative branch
} else {
// Default branch
}
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
}
var count = 0
while (count < 5) {
print(count)
count++
}
var count = 0
while (count < 5) {
print(count)
count++
}
and, or) for readability in conditionals.[1][18]
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 thevar keyword, where the compiler infers the type from the initializer expression; for instance, var count = 42 infers int, and var message = "Hello" infers String.[18] Such inference reduces boilerplate compared to languages like Java, promoting readable code without sacrificing the benefits of static checking.[3]
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.[18][1]
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.[19]
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.[9][7]
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.[18][1]
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 data processing more concise than equivalent Java code.[18] This feature captures variables from the enclosing scope, supporting true closures with covariance on return types and contravariance on parameters.[2]
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)
}
}
"alert".printWarning(), with static dispatch ensuring performance comparable to native methods.[18] 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.[20] Unlike runtime monkey patching, enhancements are verified statically and do not introduce state or fields.[2]
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 Java. Developers can catch specific exceptions like IOException or general Throwable, with guidelines emphasizing narrow catches to avoid masking errors.[21] 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.[22]
The template system in Gosu uses .gst files for code generation and dynamic content rendering, blending plain text with embedded Gosu 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}
<% } %>
MyTemplate.renderToString(names), it produces formatted output suitable for reports or web pages in enterprise scenarios.[18] Templates are statically verified, supporting type-safe interpolation with ${expression} and control structures, enhancing productivity in configuration-driven applications.[2]
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.[1][23] 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.[24] In the insurance sector, Gosu has seen significant adoption for configuring complex workflows, permitting insurers to tailor business processes—such as underwriting approvals and claims triage—without recompiling or modifying the underlying Java core code. This configuration-driven approach leverages Gosu'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.[23][25] Representative use cases include dynamic rule engines for real-time eligibility checks in policy quoting, data transformation scripts for mapping legacy system data to InsuranceSuite entities during migrations, and UI enhancements via Gosu extensions that customize screens for user-specific views without altering the platform's architecture.[23][25] 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 GitHub and expanded tooling support like VS Code extensions.[9][5] As of 2025, Gosu 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.[26][27]Tooling and Integration
Gosu provides seamless integration with the Java Virtual Machine (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 type inference for smooth interoperability.[1] Additionally, Gosu compiles source code dynamically to JVM bytecode at runtime, allowing for efficient execution alongside Java components in mixed-language projects.[28] 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.[29] 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.[15] Gosu projects are compatible with standard Java build tools, including Maven and Gradle, enabling straightforward management of mixed Java-Gosu codebases. The Gradle 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.[30] 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.[18]
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.[9] Official documentation is available at gosu-lang.github.io, covering quickstarts, grammar specifications, and advanced topics to aid adoption and extension of the language.[3]
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.[31] 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.[31]References
- https://www.wikidata.org/wiki/Q5587589
