Tungsten – an expressive, fast programming language
9 hours ago
- #programming-language
- #mathematical-computing
- #gpu-programming
- Tungsten is an object-oriented language designed for clarity and mathematical expression, with syntax that resembles whiteboard pseudocode.
- It compiles to native binaries via LLVM and GPU kernels via Metal, using a self-hosted compiler.
- Key features include first-class support for currency (dollars, cents, percentages) and units (meters, kilograms) with automatic conversion and dimensional analysis.
- Direct mathematical notation is supported, allowing code to read like textbook math with symbols like square roots and exponents.
- Syntax elements include defining classes with '+', methods with '->', and output with '<<', with explicit arity indicated by slashes.
- It offers exact decimal numbers by default, complex numbers up to 256-dimensional algebras, and GPU integration via '@gpu fn' for Metal Shading Language.
- Memory management includes shared allocations for CPU arrays and Metal buffers, enabling on-device attention mechanisms.
- The language reduces boilerplate with features like inline instance variables, block passthrough, and accumulator methods.
- It includes compile-time math modes (strict, precise, fast) and ensures performance optimizations like SIMD and branch elimination.
- Tools include a package manager, interactive REPL with plotting, and open collaboration for preview development.