The first alpha release of the Gauntlet programming language, a Go language add-on that addresses some architectural issues and adds additional functionality, is now available. Gauntlet programs support all Go features, are translated into a Go representation, and integrate with the existing Go ecosystem without the need for bindings. The toolkit developed by the project is written in F# and is distributed under the GPLv3 license. A VSCode editor add-on is provided for working with the code.
Problems solved in Gauntlet:
- Intrusive error output related to unused variables (Gauntlet adds placeholders like "_ = a" for all unused variables).
- Bloated error handling code: Gauntlet uses single-line try-with statements instead of "if err != nil" conditional blocks.
- Intrusive way of importing and exporting (for example, Go requires exported names to start with a capital letter).
- No thetar operator. In Gauntlet, you can use expressions like 'let properWord = @String len(lines) > 1 ? "lines" : "line"'.
- Lack of switch-case syntax.
- Advanced "for" loops. In Gauntlet, you can write "for let _, c in "Hello" {" instead of "for _, c := range "Hello" {".
- An unusual assignment operator (':=' for declaring and initializing variables at the same time; '=' for changing the value of already declared variables).
- Inability to call functions in a chain (Gauntlet supports calls like 'let trimmedLines = fileContentStrVersion => strings.trimSpace(_) => strings.split(_, «\n»)'.
Advanced Gauntlet Features:
- The "when-is" syntax is similar to switch.case, but manipulates expressions.
- Support for pipes, which allow a value to be passed through multiple expressions or functions in a chain. For example, "10 => add(_, 10) => add(_, 30) => divide(_, 2)".
- The expressions "try .. with" and "force .. with".
- The "wrapper" expression for creating type aliases (eg "wrapper Int Dollars").
Source: opennet.ru
