Skip to content

Releases: odin-lang/Odin

Odin v0.5.0

27 Jun 16:56
Compare
Choose a tag to compare

Changes

  • C-style varargs
    • #c_vararg
  • foreign declaration blocks
foreign libc {
	var errno: i32;
	proc c_printf(fmt: ^u8, #c_vararg args: ..any) -> i32 #cc_c #link_name "printf";
}
  • expand_to_tuple
  • Default procedure arguments
proc hello(a: int = 9, b = 9) {
	fmt.printf("a is %d; b is %d\n", a, b);
}
  • Default return values
proc foo(x: int) -> (first: string = "Hellope", second = "world!") {
	return;
}
  • Named procedure arguments
    • hello(b = 123, a = 321);
  • Named return values
    • return a = 123, b = "blah";
  • #location() and #caller_location
  • Explicit parametric polymorphic procedures
    • proc new(T: type) -> ^T { ... };
  • Command line arguments
    • -opt=0,1,2,3

Odin v0.4.0

12 Jun 20:41
Compare
Choose a tag to compare

What's New

  • Compiler compiles as C++ rather than C
  • Massive declaration syntax change
    • Declarations now use the Pascal-like prefix syntax
    • proc foo() {}
    • var x = 123;
    • var y: int = 123; (Type annotation)
    • const y = 123;
    • let z = false;
    • type Bar struct{};
    • import "fmt.odin";
    • import_load "bits.odin";
    • foreign_library "whatever.lib";
    • foreign_system_library "kernel32.lib";
  • Pascal-like declaration grouping (except for procedures)
const (
	X: int = 123;
	Y      = 456; // copies above type e.g. `int` 
	Z      = 789; // ditto
)
  • Default procedure arguments
proc foo(i: int = 123, s: string, b = false) { ... }
foo(s = "Hellope");
foo(b = true, s = "Potato");
foo(1337, "Googolplex");
foo(99, "Whatever", false);
// Cannot mix named and non-named - consistent with compound literals
  • foreign blocks
foreign_library lib "some_lib.lib";
foreign lib {
	proc the_variable() -> bool #link_name "sl_the_variable";
}
  • let single assignment variables
    • Replaces immutable
var a = 123; // Mutable variable
a = 456; // Okay
let x = 123; // Immutable variable
x = 456; // Cannot assign to again

Odin v0.3.0

08 Jun 10:44
Compare
Choose a tag to compare

What's New

  • bit_field
  • Lexical Sugar: , ,
  • u128 i128
  • Label syntax change:
    • name: for { break name; }
  • %% divisor based modulo operator
  • "bits.odin"
  • Casting syntax change:
    • Regular cast: type(expr)
    • Bit cast: transmute(type, expr)
    • Type assertion (replaces union_cast): expr.(type)
  • Address of operator & replacing ^
    • Pointer types and dererefencing still use ^
  • default: replaced with case:
  • #ordered reimplemented
  • #no_alias (replacing keyword no_alias)
  • XOR for booleans
  • rune as a basic type rather than alias of i32
    • Provides extra type information at runtime
  • byte is removed
    • Use u8 instead
  • Removed quaternion128 and quaternion256

Naming Convention

Odin has finally chose an official naming convention
In general, PascalCase for types and snake_case for values.

Import Name:        snake_case (but prefer single word)
Types:              PascalCase
Union Variants:     PascalCase
Enum Values:        PascalCase
Procedures:         snake_case
Local Variables:    snake_case
Field Values:       snake_case
Constant Variables: SCREAMING_SNAKE_CASE

Odin v0.2.1

01 May 14:33
Compare
Choose a tag to compare

Added

  • Allow vector math with its element type
  • for in iteration of enum Type

Changes

  • bprint* returns a string now

Fixes

  • Fix statement parsing of unary & and ^
  • Fix IR vector arithmetic bug
  • Fix unary expression for vectors

Odin v0.2.0 - Windows

30 Apr 16:00
Compare
Choose a tag to compare

Added

  • Complex numbers

    • complex64, complex128
  • Quaternions

    • quaternion128, quaternion256
  • New built in procedures

    • conj(x)
    • len(x), cap(x)
    • make([]T), make([dynamic]T), make(map[K]V)
    • transmute(T, x)
  • #require_results for procedures

  • Interval syntax

    • a..b open range [a, b]
    • a..<b half-closed range [a, b)
  • Interval expression is match statements

    • case 'A'..'Z', 'a'..'z':
  • Addressing operator & (replaces ^)

    • x: int; p: ^int = &x; i: int = p^;
  • New casting syntax

    • Basic type conversion: type(x)
      • Replaces cast(type)x
    • Type assertion: x.(type)
      • Replaces union_cast and works with any not just unions
    • Bitcast: transmute(T, x)
      • Replaces transmute(T)x
  • os.args Command line arguments in os.odin

  • Correct C ABI for x86/amd64 on Windows

Changes

  • Remove .count and .capacity and replace with len() and cap()
  • Remove new_slice and replace with `make
  • Removed down_cast
  • Move Raw_* types to raw.odin
  • Change memory layout of any
  • Changes to fmt.odin
    • Remove sprint*
    • Add aprint*, bprint*, sbprint*
  • strconv.parse_int in strconv.odin

Bug fixes

  • Cast to any of untyped constants
  • Fix append crash when pointer is passed
  • Fix slicing bug on dynamic arrays
  • Fix map key not getting transferred on rehash
  • Bugs with union size and alignment
  • Fix procedure literal scopes and dependencies
  • Fix subtype polymorphism
  • Fix double declaration in when statements
  • Fix float precision printing

Odin v0.1.3

27 Mar 19:46
Compare
Choose a tag to compare

Added

  • Slices now store have capacity (again)
  • Added multiple type cases for match in
  • Named for and match statements (#label)
  • ++ -- statements return

Changes

  • fmt.odin uses ^[]byte and []byte rather than custom buffer type
  • ... and ..< removed and replace with ..
  • .. is used for slice parameters and in for in statements which is equivalent to the old ..<
  • append allows pointers
  • new_slice allows for capacity

Bug Fixes

  • Signed integer conversion
  • fmt.odin fix printing enums
  • Fix tuple type info bug

Odin v0.1.1

24 Feb 19:56
Compare
Choose a tag to compare

Added

  • Entities and record fields prefixed with an underscore do not get exported on imports
  • Records have an implicit names fields, a []string of all the names for that record (struct/raw_union/enum)
  • New built-in procedures
    • slice_to_bytes - convert any slice to a slice of bytes
    • delete - remove an entry from a map
    • clear - clear the contents of a map or dynamic array (e.g. set the count to zero)
    • reserve - reserve memory for the dynamic map or array
  • union_cast allows for an optional "ok" check; will panic if the cast is invalid and the ok check was not used
  • ?: ternary operator (replaces block and if expressions)
  • Unions with variants and common fields

Changed

  • Core library additions to Windows specific stuff

Fixes

  • Overloading bug due to comparison of named types
  • Overloading bug due to #import . collision
  • Disallow a cast from a pointer of a union (use union_cast instead)
  • Minor bugs in generated IR code for slices

Odin v0.1.0

11 Feb 21:22
Compare
Choose a tag to compare

Added:

  • Dynamic Arrays [...]Type
  • Dynamic Maps map[Key]Value
  • Dynamic array and map literals
  • Custom struct alignemnt struct #align 8 { bar: i8 }
  • Allow _ in numbers
  • Variadic append
  • fmt.sprint*
  • Entities prefixes with an underscore do not get exported on imports
  • Overloaded free for pointers, slices, strings, dynamic arrays, and dynamic maps
  • enum types have an implict names field, a []string of all the names in that enum

Removed:

  • Maybe/option types
  • immutable variables
  • Remove type keyword and other "reserved" keywords

Changed:

  • compile_assert and assertreturn the value of the condition for semantic reasons
  • thread_local -> #thread_local
  • #include -> #load
  • Files only get checked if they are actually used
  • match x in y {} // For type match statements
  • Version numbering now starts from 0.1.0 and uses the convention:
    • major.minor.patch

Fixes:

  • Many fmt.* fixes

To come very Soon™:

  • Linux and OS X builds (unofficial ones do exist already)

Odin v0.0.6b

29 Jan 14:47
Compare
Choose a tag to compare

Bug Fixes

  • Fix assignment of "untyped" constants to any (issue #13)
  • Fix crash when passing arguments with no value/type to a call

Odin v0.0.6a

28 Jan 20:19
Compare
Choose a tag to compare

What's New

  • Overloaded free
    • Accepts pointers, slices, and strings
  • 3 dotted ellipsis ...