Spaceship Language Specification Spaceship is a high-performance systems automation language designed to replace legacy shell scripting. It features a strict, Go-inspired syntax, a powerful fixed-width type system, and a novel JIT (Just-In-Time) compilation model for POSIX commands, all built on top of LLVM. Core Principles Performance: Statically typed and JIT-compiled for maximum execution speed. Statically typed and JIT-compiled for maximum execution speed. Security: Eliminates shell injection vulnerabilities through a strict Process API powered by direct OS-level syscalls. Eliminates shell injection vulnerabilities through a strict API powered by direct OS-level syscalls. Reliability: A clear, explicit error handling model based on POSIX exit codes. A clear, explicit error handling model based on POSIX exit codes. Modern Syntax: A clean, Go-inspired syntax that is easy to read and write. Type System Spaceship uses a strict, fixed-width type system. There is no type inference; all types must be explicitly declared. Type Table Type Description Syntax Example i1 Boolean type var is_active i1 = true i8 - i128 Fixed-width signed integers var user_id i64 f32 , f64 Floating-point numbers const PI f64 = 3.14159 u8[] Raw byte array (string) var message u8[] = "hello" [<size>]<type> Fixed-size array var buffer [1024]i8 map[<k>]<v> Hash map var scores map[u8[]]i32 Error Handling: The !i32 Contract Spaceship uses an explicit error handling mechanism that maps directly to POSIX exit codes and errno . Any function that can fail must declare its return type with a ! prefix, indicating that it returns an error contract. Example: fn readFile(path u8[]) !i32 On success, the function returns a non-zero value. On failure, it returns a standard POSIX error code (e.g., ENOENT for "No such file or directory"). This contract is enforced by the check {} except {} block. check { // Code that might fail var fd = readFile ( "my_file.txt" ) } except { // This block executes if readFile() re...
First seen: 2025-12-19 09:16
Last seen: 2025-12-19 11:16