Compiler Videos vs Current State of Jai

This article compares the current state of the Jai Programming Language against Jonathan Blow’s Compiler Videos. The Jai Programming Language has changed significantly since those videos have been posted, and this article attempts to keep track of language features which are still in the language, and which language features have been replaced/removed.

Data-Oriented Demo: SOA, composition

  • SOA (Structure of Arrays) have been removed from the language. This has been replaced by a more generalized metaprogramming system involving #insert directive. See SOA.
  • using is still in the language

Macros and Iteration

  • for_expansion no longer has the function signature for_expansion :: (obj: *Object, code: Code, a: bool, b: bool). It now has the function signature for_expansion :: (obj: *Object, code: Code, flags: For_Flags).
  • Macros can return values

Structs with Parameters

  • Structs and Function Polymorphism concepts have been unified together
  • Objects can now be written as:
Object :: struct(t: $T) {
  // stuff
}
  • You can do arrays as: array: [$N] int
function :: (array: [$N] int) {

}
  • Array literals have been changed. Now the syntax is: int.[1,2,3,4,5,6].

Constructors, Destructors

  • Constructors and Destructors have been removed from the language

Polymorphic Procedures, part 2

  • #body_text has been removed from the language. Use #insert directives.
1 Like