Skip to content

dev-2023-03

Compare
Choose a tag to compare
@gingerBill gingerBill released this 03 Mar 11:56
· 5121 commits to master since this release

New Language Features

  • BREAKING CHANGE: Brand New Default context.temp_allocator Implementation
    • New version is a growing arena based approach
      • Old version used an unsafe ring buffer
    • IMPORTANT free_all(context.temp_allocator) must be called to clear the contents of the internal arena (unlike the previous ring buffer)
      • It is recommended that this is done per frame/cycle/etc
  • expand_values()
    • Built-in procedure which expands a struct or fixed-length array into multiple values
Foo :: struct {x: f32, y: i32}
f := Foo{1, 2}
a, b := expand_values(f)
assert(a == 1 && b == 2)
  • Allow comparisons between empty struct{} and union{}
  • Allow for assigning to fields through using in a compound literal
Foo :: struct {
	using x: struct { // named `using` fields
		y: int,
	},
	z: f32
	using _: struct { // anonymous `using` fields
		w: bool,
	},
}

f := Foo{
	y = 123, // equivalent to `x = {y = 123},`
	z = 456,
	w = true,
}
  • Verbose error messages by default with optional ANSI colouring too:
    • Previous behaviour is available with -terse-errors
    • Automatic detection of ANSI colours is currently only supported for Windows
    • set ODIN_TERMINAL=ansi to force ANSI colouring
    • Line printing with indication of the error location below
      image

Compiler Improvements

  • @(fini) to complement its opposite @(init)
  • Fix to byval parameters on Darwin SysV ABI which in turn fixes #by_ptr
  • Rename to runtime.Type_Info_Parameters for procedures inputs and outputs
  • Fix issue that conflicts with constant parapoly procedure literals and @(deferred_*)
  • Numerous improvements to error messages

New Packages

Package Improvements

  • Introduction of time.tsc_frequency()
  • Improvements to core:mem/virtual's Arena
    • On free_all free all memory blocks except for the first one
    • virtual.arena_destroy will free all memory blocks including the first one (assuming Growing or Static)
  • Add #optional_allocator_error to make_map
  • Numerous improvements to the vendor:directx packages