Releases: odin-lang/Odin
Releases · odin-lang/Odin
v0.11.0
New Features:
- Ranged fields for array compounds literals
foo := [?]int {
0 = 123,
5..9 = 54,
10..<16 = i*3 + (i-1)*2,
};inline forloops (only forinbased for loops)
inline for x, i in 1..<4 {
fmt.println(x, i);
}whereclauses for procedures, structs, and unions
foo :: proc(x: [$N]int) -> bool
where N > 2 {
fmt.println(#procedure, "was called with the parameter", x);
return true;
}- Proper System V AMD64 Support on Darwin and Linux
- Built-in Quaternions (Not just an April Fool's Joke any more)
quaternion128andquaternion256
- Struct field tags
Foo :: struct {
x: int `tag1`,
y: string `json:"y_field"`,
z: bool, // no tag
};- New and improved
package math - New
package math/linalg intrinsics.type_*package reflect(replacespackage types)union #no_nilmem.slice_data_cast#panic- Add
@forceforforeign import - Add minor suggestions to errors on casts and assignments
- Change
ODIN_OSstring for macos/osx "osx" to "darwin" to allow for other platforms - Add dummy packages purely for documentation of
builtinandintrinsics
Updates:
- Type inference improvements for call expressions and procedure group parameters
- Update
package odin_parseret al. require_resultsis now an attribute rather than a suffix tag for procedures- Improved multi-threaded parser
- Change the behaviour of
foreign importon darwin to be more consistent with other platforms fmt.print*_errhas been replaced withfmt.eprint*- Consistent
typeidsemantics across all assignments - Improvements to
package unicode/utf8
Bug fixes:
- Fix ranges in switch statements for strings
- Fix comparison for bit field values
- Fix double-pointer indexing bug
- Fix procedure group compiler assert with no matching arguments
- Fix procedure constant declarations value type assignment checking
- Fix disallow blank identifier polymorphic types
$_ - Fix unions with zero variants
- Fix bounds checking on slices for constant parameters
- Fix array comparisons
- Fix
~(1 << x)inference bug - Fix Using any in if statement
- Fix
#completeswitch with pointer case - Fix procedure group "best fit" algorithm for polymorphic procedures
- Fix double calling of LHS of logical binary expressions
- Fix stack overflow bug caused by polymorphic record with polymorphic parameters
- Fix polymorphic record parameter determination bug caused by polymorphic constants not be handled correctly
v0.10.0
- Implicit Selector Expressions
- Half-closed range
a..<b([a, b))- This is alongside the closed range
a..b([a, b])
- This is alongside the closed range
notinbinary operator formapandbit_settypes:x notin y(equivalent to!(x in y))
- Endian specific integers
- e.g.
i32,i32le,i32be
- e.g.
- Reintroduction of
i128andu128 - Labels for blocks and if statements (
breakonly) - Improved common parsing errors (e.g. C-style
->for selectors rather than Odin-style.) - Import name rules
- The import name for the package will try to be determined from the import path
- Context-based Logging system
#load- Load a file at compile time as a byte slice
- Procedure group syntax change to
proc{} - General core library improvements
- Odin Parser as part of the core library
import "core:odin/parser"et al.
- New build flag:
-define:foo=123 #definedbuilt-in procedurewhen #defined(FOO) { ... }
- Improved
-vet - Replace
foreign exportwith@export @private@static
Experimental Features
odin query-go-to-definitions(OGTD file format)-global-definitions(JSON file format)-compact(compactify the JSON file)
intrinsics.vectortype
Related Topics
- New Odin website: https://odin-lang.org
- New Odin documentation: https://odin-lang.org/docs/
Odin v0.9.1
Bug Fixes
- Debug fix
- Recursive loop bug for polymorphic types
#complete switchfor pointers to unions- Allow for single fields
struct #raw_union - Redefine how union tag size is calculated to match alignment of the union data
Odin v0.9.0
New Features
packagesystem- Improved PDB support with code inspection
typeidtype (also a keyword)typeis not a keyword any moreopaquetype- Parameteric polymorphic union type:
union(T: typeid, N: int) {int, T, [N]T}
bit_settype:bit_set[Some_Enum];bit_set['A' .. 'Z'];bit_set[0..8; u16];
cstringtype (useful for interfacing with C libraries)inbinary operator formapandbit_settypes:x in y
- Parametric polymorphic signature changes with polymorphic names:
new :: proc($T: typeid) -> ^T {}make_int_array :: proc($N: int) -> [N]int {}foo :: proc($N: $I, $T: typeid) {}
auto_castunary operator- Explicit
inlineandno_inlineon procedure calls deprecatedattributes- Built-in procedures:
#defined#assertcompile time assertexpand_to_tuplefor (fixed length) arraystypeid_of
"intrinsics"package:- Atomics
- Diverging procedures
proc() -> !(no return) using Foo :: enum {A, B, C}; f := A;Foo :: enum {A, B, C}; len(Foo)- New
contextfeatures:temp_allocatorlogger(Still in development)- Assigning directly to context parameters creates a new
context - (
contextis scope based)
- New compiler flags:
-lld(use LLD as the linker on Windows)
- Improved minimum dependency building
foreign import x {"foo.lib", "bar.lib"}
Removed Features
using in- Old import system (replaced with the
packagesystem)
LLVM Binaries for Windows
llvm-windows Allow enums for array lengths
Odin v0.8.1
Fixes
- Fix initialization value for variables
Odin v0.8.0
New Features
- Basic Debug Information Support
- PDB generation with
-debug
- PDB generation with
distincttypesMy_Int :: distinct int;My_Int != intFoo_Bar :: int;Foo_Bar == intstruct,enum,union,proc, andbit_fieldtypes will always be distinct if named
- Sized booleans
b8b16b32b64
- Removal of 128 bit integers
using inusing println in import "core:fmt.odin"using a, b, c in foo;
enum #exportFoo :: enum #export {A, B, C}; a := A;
- Explicit procedure overloading
foo :: proc[bar, baz, asd, goop];
- Remove of implicit procedure overloading
- New build flags:
-no-bounds-check-debug
- Improved minimal dependency build
Odin v0.7.1
Patch Changes
- Update version string
- Update command line usage text
New Features
- New importation system
importusing importexport
- Import collections
- `import "core:fmt.odin"
import "shared:glfw.odin"-collection=foo=path/to/foo
- Improved
foreignsystemforeign importforeignblocksforeign exportblocksforeign import "system:kernel32.lib"
- Global variable dependency initialization ordering
- Attribute system
@(link_name="gb_foo") foo :: proc() {};@(link_prefix="gb_") foo :: proc() {};- Please see wiki for more
- Array Programming - arithmetic on fixed length arrays
a, b: [4]f32;
c := 2*(-a + b) / 3;
d := swizzle(c, 1, 0, 3, 2);
uintptr- Type aliases
My_Int :: #alias int;
inlineandno_inlineprefix keywords for procedure literalsfoo :: inline proc() {}
- Procedure calling convention syntax
proc "c" ()proc "std" ()proc "contextless" ()
- Default arguments allowed after a variadic parameter
print :: proc(args: ...any, loc := #caller_location) {}
- Polymorphic array lengths
proc(a: [$N]$T)
Syntax Changes
switchreplacesmatchcontext <- expr {}replacespush_context expr {}push_allocatorhas been removed in favour of general procedures to generate contexts-build-mode=dllreplacesbuild-dll
Core library additions
mem.ptr_to_bytesassertandpanicuseprintfstyle parameters
Odin v0.7.0
New Features
- New importation system
importusing importexport
- Import collections
- `import "core:fmt.odin"
import "shared:glfw.odin"-collection=foo=path/to/foo
- Improved
foreignsystemforeign importforeignblocksforeign exportblocksforeign import "system:kernel32.lib"
- Global variable dependency initialization ordering
- Attribute system
@(link_name="gb_foo") foo :: proc() {};@(link_prefix="gb_") foo :: proc() {};- Please see wiki for more
- Array Programming - arithmetic on fixed length arrays
a, b: [4]f32;
c := 2*(-a + b) / 3;
d := swizzle(c, 1, 0, 3, 2);
uintptr- Type aliases
My_Int :: #alias int;
inlineandno_inlineprefix keywords for procedure literalsfoo :: inline proc() {}
- Procedure calling convention syntax
proc "c" ()proc "std" ()proc "contextless" ()
- Default arguments allowed after a variadic parameter
print :: proc(args: ...any, loc := #caller_location) {}
- Polymorphic array lengths
proc(a: [$N]$T)
Syntax Changes
switchreplacesmatchcontext <- expr {}replacespush_context expr {}push_allocatorhas been removed in favour of general procedures to generate contexts-build-mode=dllreplacesbuild-dll
Core library additions
mem.ptr_to_bytesassertandpanicuseprintfstyle parameters
Odin v0.6.2
Changes
Slightly modify the naming convention.
In general, Ada_Case for types and snake_case for values
Import Name: snake_case (but prefer single word)
Types: Ada_Case
Union Variants: Ada_Case
Enum Values: Ada_Case
Procedures: snake_case
Local Variables: snake_case
Constant Variables: SCREAMING_SNAKE_CASE