Skip to content

Flux version 1.4.0

Choose a tag to compare

@kvthweatt kvthweatt released this 06 Jul 14:41
· 100 commits to main since this release
27b7d48

Flux v1.4.0 Changelog

New Features

C to Flux Translation Utility (cft.py)

A new tool that translates C source files (.c and .h) into Flux (.fx) using libclang. Supports full function body translation, struct/union/enum/typedef declarations, function pointer typedefs, macros, bitfields, _Alignas, and __int128/__uint128_t as paired 64-bit structs mirroring GCC/Clang ABI. Accepts single files or entire directories, pairing .c/.h files by stem into a single .fx output.

comptime Blocks

Compile-time execution is now supported via comptime blocks. The FVM (Flux Virtual Machine) executes code at compile time, enabling metaprogramming, code generation via emitflux/~$, and FFI at compile time. comptime blocks can now be placed inside structs. Inline ASM is executable at comptime via keystone-engine.

Object Inheritance

Objects now support inheritance. Use + on a child def to override a parent method signature. +callconv syntax is valid within objects for member function definitions, and child objects can override parent methods with !+callconv.

Interfaces

New interface keyword for defining object interfaces. Interfaces enforce traits on implementing objects. New syntax forms: A(B) and A->B. Trait reflection supported via the has keyword: if (myObj has SomeTrait).

Template Constraints (constraint)

Named template relational constraint sets via the constraint keyword (renamed from constra). Constraints are required within :{} blocks inside template definitions. Constraint sets can be combined, parameters renamed, and relational checking enforced (A ~ B, A !~ B). Default types for template parameters are now supported.

Type Functions

Functions can now be defined on types and literals of that type, including structs. Type functions support templates, pointer types, and i-strings.

Algebraic Types

Infrastructure for type relation algebra, with new type relation operators.

not in / !in Operator

Inverse of the in operator. x !in y returns true when x is not a member of y.

REPL (frepl.py)

Interactive Flux REPL added. Also added compiler.fvm.dump(path) builtin to dump comptime FVM opcodes up to the call point to a .fvm file for inspection and standalone execution.

Disassembler (disasm.fx, disasm_x86-64.fx)

New standard library modules for executable disassembly. Precursor to an executable editing suite.

New Standard Library Modules

  • sorting.fx - sorting algorithms
  • search.fx - search algorithms
  • rle.fx - run-length encoding
  • shadowstack.fx - opt-in per-function shadow stack with per-call canary randomization
  • encodings.fx - character encoding utilities
  • csv.fx - CSV parsing
  • matrices.fx - matrix math
  • disasm.fx / disasm_x86-64.fx - executable disassembly

Improvements

  • typeof now has proper per-type distinction; struct types no longer collapse to the same value
  • emitflux and ~$ codification: multiple fixes to compile-time code emission
  • Templated struct inheritance (struct A<T> : B<U>) now correctly produces A<T,U>
  • ++ now works on array index elements (e.g. x[2]++)
  • Multidimensional array type inference from literals fixed
  • Forward references for objects fixed
  • private now supports friend syntax: private : FriendObj1, FriendObj2 { ... };
  • Loop variable declarations (e.g. for (int x;)) no longer cause stack overflows
  • Compiler now detects alternate return routes; return no longer required at the end of a function if a return exists on all paths
  • byte and char integer literal support added to the lexer
  • Scientific notation added to the lexer
  • Inline ASM error messages now show the ASM block itself
  • cdecl functions no longer require !! to suppress name mangling; cdecl implies no mangling

Bug Fixes

  • Fixed Linux heap operations causing segfault
  • Fixed datetime.fx for Linux and macOS
  • Fixed cast widening not recognizing unsigned types
  • Fixed incorrect array index sign extension on unsigned types
  • Fixed array element type metadata
  • Fixed xml.fx
  • Fixed f-string function name lookup and runtime f-strings
  • Fixed struct type context detection in codegen
  • Fixed template parsing for pointer-of-templated-type
  • Fixed try/catch/throw
  • Fixed preprocessor NT path to Unix path conversion
  • Fixed parser regression in C-style array declaration detection
  • FVM: fixed i-string codification, added TernaryOp support
  • FVM temp files now written to build directory instead of /src/stdlib for compatibility with the online compiler
  • Architecture config override: flux_config.cfg is now overridden if architecture setting does not match compiler-detected architecture

Platform

  • macOS ARM64 compilation fixes
  • macOS setup guide contributed by community
  • Linux segfault from heap operations resolved

Documentation

  • Language specification updated to include interface, using, constraint, algebraic types, #package importing, and compiler internals
  • Standard library documentation updated for shadowstack.fx, file_object_raw.fx, and others
  • Notepad++ and VSCode syntax highlighting improved; missing keywords added
  • Official website: https://fluxspl.org/ | Online IDE: https://fluxspl.org/ide