Gosu (programming language): Difference between revisions

Content deleted Content added
m Clean up
Split lead, create new Data types section under Syntax and semantics
Line 24:
| wikibooks =
}}
'''Gosu''' is a [[Type system#Static type-checking|statically-typed]] [[programming language]] that runs on the [[Java Virtual Machine]] released under the [[Apache license|Apache 2]] license.<ref name=slashdot>{{cite web|url=http://slashdot.org/story/10/11/09/0510258/Gosu-Programming-Language-Released-To-Public|title=Gosu Programming Language Released To Public|date=2010-11-09|publisher=[[Slashdot]]}}</ref> This general-purpose programming language is used in several [[open-source software]] projects including [https://sparkgs.github.io/ SparkGS] and [https://github.com/gosu-lang/ragnardb Ragnar DB] among several others, and is widely used in the insurance industry via [[Guidewire Software]]'s commercial products.<ref name=slashdot/><ref>{{Cite news|url=http://www.pcpro.co.uk/news/362638/gosu-brings-fresh-language-skills-to-java-virtual-platform|title=Gosu brings fresh language skills to Java Virtual Platform|publisher=[[PC Pro]]|date=2010-11-09}}</ref> The language borrows from several existing languages including [[Java (programming language)|Java]], [[C Sharp (programming language)|C#]], and [[ECMAScript]].

A notable and 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. Also of note is the language's ability to serve as both a full-featured general purpose language and as a concise scripting language. For instance, Gosu has 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==
Line 33 ⟶ 35:
Gosu language creator and development lead, Scott McKinney, emphasizes pragmatism as the overriding principle in Gosu's design.<ref name=drdobbs>{{cite web|url=http://www.drdobbs.com/open-source/language-of-the-month-gosu/231001429#|title=Language of the Month: Gosu|date=2012-12-07|publisher=[[Dr. Dobb's Journal]]}}</ref> For instance, code readability is paramount. While the Gosu team tries to strike a balance between conciseness and readability, it favors readability as code tends to be read many times more than it is written. This simple idea has helped to keep Gosu a low-ceremony, pragmatic language. Discoverability is also a key principle that guides the language's design. With the aid of modern IDEs programmers must be able to quickly and deterministically apply static analysis to large Gosu codebases, some of them approaching 1M lines of code. As such Gosu's rich static type system is a necessary ingredient toward best of breed tooling via static analysis, rich parser feedback, intelligent 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 Semanticsemantics==
Gosu follows a syntax resembling a combination of other languages. For instance, declarations follow more along the lines of [[Pascal (programming language)|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)|Go]] programming language.
 
Line 53 ⟶ 55:
}
}
</syntaxhighlight>
</syntaxhighlight>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.<syntaxhighlight lang="gosu">
 
===Data types===
</syntaxhighlight>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.<syntaxhighlight lang="gosu">
enhancement MyStringEnhancement : String {
function print() {