Skip to content

Odin v0.6.0

Compare
Choose a tag to compare
@gingerBill gingerBill released this 30 Jul 21:30
· 12853 commits to master since this release

Additions and Changes

  • Restore original declaration syntax
  • Parametric Polymorphism ("Generics")
    • Procedures
      • new :: proc(T: type) -> ^T {...}
      • new_clone :: proc(v: $T) -> ^T {...}
      • copy :: proc(dst, src: $T/[]$E) -> int {...}
    • Structures
      • Vector :: struct(N: int, T: type) { e: [N]T; };
    • Type specialization
      • make :: proc(T: type/[]$E) -> T {...}
      • add :: proc(a, b: $T/Vector) -> T {...}
      • sub :: proc(a, b: $T/Vector) -> T {...}
      • foo :: proc(b: ^Bar($T, $E)) {...}
      • exists :: proc(m: map[$K]$V, key: K) -> bool {...}
  • union
    • union{int, f32, FooBar, string, map[int]string}
    • Duality between any and union now. Same usage with syntax.
  • raw_union is now a tag on struct
    • struct #raw_union {...}
  • struct fields use semicolons
    • struct {x: f32; y: int; z: string}
  • Nested Struct Declarations
struct {
	// constants
	FOO   :: 123;
	MyInt :: int;

	// fields
	x: int;
}
  • Default Struct Values
struct {
	s: string = "Hellope";
	i := 123;
	b: bool; // zero value	
}
  • do for inline statements rather than block
    • if cond do foo();
  • Removed ++, --
    • Use += and -= instead
  • Removed atomic
  • Type operator precendence change
    • ^T(x) == ^(T(x))
  • Additional casting syntax
    • cast(T)x
    • (T)(x)
  • Uninitialized value ---
  • Removal of *_val_of
    • Replaced with size_of, align_of, offset_of, type_of, type_info_of
  • Compiler options:
    • -opt=0,1,2,3
    • -show-timings
    • -thread-count=4
  • Multi-threaded Parser