Skip to content

Tiny v0.2.2 - Generics, JIT, and Native Modules

Choose a tag to compare

@confh confh released this 11 Jun 12:21

Tiny v0.2.2 - Generics, JIT, and Native Modules

This release introduces a sophisticated generics system, a WASM-based JIT compiler for the runtime, and expands the standard library with native WebSocket and System Tray support.

Language and Type System

  • Generics (:T): Functions, classes, and interfaces now support type parameters. The compiler performs deep type checking and supports automatic type inference for constructor and function calls.
  • Enum Types: Added support for string and number-based enums. The compiler ensures type safety when assigning enum members and validates match exhaustiveness.
  • Type Narrowing: Enhanced LSP intelligence for typeof, instanceof, and null-check narrowing, including support for negated conditions and else-block inference.
  • Unreachable Code Detection: The analyzer now identifies and warns about unreachable code blocks and missing return paths in typed functions.

Runtime and Performance

  • WASM JIT Compiler: Introduced an experimental JIT compiler using wazero. It transparently compiles hot bytecode sequences specifically arithmetic and direct recursion into WASM for near-native execution speeds.
  • WebSocket Module: A new native websocket module providing both client and server implementations with support for JSON payloads and binary buffers.
  • System Tray Integration: Added a tray module for creating cross-platform system tray applications with support for custom menus, icons, and notifications.
  • Bytecode Refinement: Updated the bytecode format to preserve type parameter metadata for runtime interface validation.

Developer Experience (LSP)

  • Implement Missing Methods: A new code action for classes that embed interfaces or other classes, automatically generating stubs for missing fields and methods.
  • Enum Match Exhaustiveness: The LSP now warns if a match statement on an enum does not cover all possible members or lacks a default case.
  • Library Auto-Imports: Expanded the LSP's symbol discovery to include members of generic classes and interfaces.

CLI and Tooling

  • Interactive Help: Added a dedicated help command with detailed documentation for all CLI subcommands including build, pack, dist, and install.
  • Version Update: Bumped the internal bytecode version to 21 to support generic metadata.