Releases: odin-lang/Odin
Releases · odin-lang/Odin
dev-2021-07
New Language Features
- Swizzling syntax for arrays len <= 4 (GLSL-like behaviour)
- e.g.
v.xyz
,v.zyx
,v.xxx
- e.g.
v.rgb
,v.bgr
,v.rrr
- e.g.
- Optional Ok Pointer addressing mode:
ptr, ok := &m[v];
ptr, ok := &v.(T);
- Disallow
defer
s in a scope which terminates with a diverging procedure-> !
- Compound literals for
struct #raw_union
types - Allow alternative syntax for
offset_of
:offset_of(Struct_Type, field)
(current syntax)offset_of(value.field)
(new alternative syntax)
Compiler Improvements
- Performance optimizations for
switch
statements (normal and type) - Performance optimizations for array programming
Packages
- Remove
context.thread_id
- Improve documentation for the Odin binary doc-format spec
- Improvements to
reflect
- Add
intrinsics.type_is_endian_platform
- Add
bufio.Scanner
- Add
bufio.Lookahead_Reader
- Many improvements to
png
- Many improvements to
gzip
- Many improvements to
zlib
- Huge performance improvements to hashing procedures:
hash.crc32
hash.adler32
Bug Fixes
- Fix
filepath
bug leak - Improve linalg.transpose return type behaviour
- Fix 128-bit integer to float cast by explicitly calling the procedure (was an LLVM bug)
- Fix
-lld
on Windows - FIx double evaluation buf with selector call expressions
x->y(z)->w(a)
- Fix semicolon insertion rule for
---
dev-2021-06
New Language Features
- Allow unions to be comparable if all the variants are comparable
- Comparable unions allowed as map keys
- Improve implicit selector expression inference rules with unions
- Unified
cond ? x : y
andx if cond else y
logic - Improve type inference system to allow
&{}
alongside&T{}
in some cases - Change
for in x..y
behaviour to prevent the possibility of overflowing on maximum integer size and causing an infinite loop - Allow
..=
alongside..
as a "full range" operator (..=
will probably replace..
for ranges) - Remove
@(static)
for global variables - Add
@(link_section=<string>)
for global variables - Add intrinsics:
mem_zero
,mem_copy
,mem_copy_non_overlapping
,sqrt
,ptr_offset
,ptr_sub
Compiler Improvements
- Tokenize
++
and--
as tokens but disallow them in the parser, and give better error messages for they are used as operators/statements - Add
-verbose-errors
- Improved parsing error messages
- EXPERIMENTAL
-use-separate-modules
support (useful for speeding up code generation in development builds) - Correct SysV ABI edge cases
- Array arithmetic code generation improvements for small arrays
Packages
- package core:odin/printer
- package core:odin/format
- package core:odin/doc-format
- package core:math improvements for
f16
- package core:image/png fixes
- Added
test.fail_now
- Add
soa_zip
andsoa_unzip
to demo
Fixes
- Numerous bug fixes
dev-2021-05 New Backend Release
Compiler Changes
- Removal of the old backend which manually produced
.ll
files and passed them to the LLVM binaries directly- Removes need for
llc
andopt
binaries
- Removes need for
- LLVM C API based backed as the main backend for all platforms and targets
- Removes need for
-llvm-api
- Removes need for
- Full debug symbols support for Windows (*nix is still experimental)
- M1 ARM64/AARCH64 Support
-target:darwin_arm64
-strict-style
style as default- New Versioning System
dev-yyyy-mm:sha
- New flags
-build-mode
modes:llvm-ir
assembly
-o:<string>
flag as an alternative to-opt:<integer>
- Accepted values:
mininal
,size
,speed
- Accepted values:
-vet-extra
for extra vet checks (many usually false positives)-microarch:<string>
-disallow-do
-default-to-nil-allocator
ODIN_ROOT
environment variable to be able to change the root directory for the Odin root pathodin test
- build ands runs procedures with the attribute
@(test)
in the initial package
- build ands runs procedures with the attribute
odin doc
- generate documentation from a .odin file, or directory of .odin files
-doc-format
Generates documentation as the .odin-doc format (useful for external tooling)
- Improvements to
-vet
- Many bug fixes
Language Changes
- Ability to iterate on
#soa
types with afor
-in
loop soa_zip
(generate #soa type from slices)soa_unzip
(generate slices from #soa type)make_soa
anddelete_soa
- Allocator procedure signature change to support return a
[]byte
andAllocator_Error
code - Removal of
intrinsics.x86_mmx
- Remove
#opaque
types - Remove
bit_field
types- Prefer
bits.bitfield_extract
andbits.bitfield_insert
procedures located incore:math/bits
- Prefer
- Replace
inline
andno_inline
with#force_inline
and#force_no_inline
, respectively - Improved
#optional_ok
logic - New procedure attributes:
@(disabled=<boolean>)
@(cold)
@(optimization_mode=<string>)
f16
,f16le
,f16be
types- Removal of "pure" calling convention
- Addition of "naked" calling convention (removes prologue and epilogue)
min(T)
/max(T)
support whereT
is a float- Make any
struct
comparable as long as all of its fields are comparable - Make any comparable type a valid
map
key type //+build ignore
tag- Useful for examples within a
package
- Useful for examples within a
Core Library Changes
New Packages
core:bufio
core:bytes
core:c/frontend/tokenizer
core:c/frontend/preprocessor
core:compress
core:compress/gzip
core:compress/zlib
core:image
core:image/png
core:io
core:math/fixed
core:path
(URI-like paths)core:path/filepath
(OS paths)core:slice
core:sort
core:text/scanner
Experimental Packages
core:sync/sync2
(will replacecore:sync
when finished)
New Additions to package intrinsics
volatile_load
volatile_store
debug_trap
trap
alloca
cpu_relax
read_cycle_counter
count_ones
count_zeros
count_trailing_zeros
count_leading_zeros
reverse_bits
byte_swap
overflow_add
overflow_sub
overflow_mul
expect
type_has_field
type_proc_parameter_count
type_proc_return_count
type_proc_parameter_type
type_proc_return_type
type_polymorphic_record_parameter_count
type_polymorphic_record_parameter_value
type_field_index_of
type_equal_proc
type_hasher_proc
pre-dev-2021-04 Pre Old Backend Removal Release
Transitionary release for two things:
- Replacing the Old Backend with the New Backend Transition Period #891
- New Odin Versioning System for Pre Version 1.0 #887
Notes
Please use this release if you are still relying on the old backend for your projects.
Release notes will be published in the release in which the old backend is removed.
v0.13.0
New Features
- LLVM C API integration for Windows through
-llvm-api
- Experimental Support for
-llvm-api
for Linux and MacOS union #maybe
directive- Built-in
Maybe
type, e.g.Maybe(int)
orMaybe(^T)
- Selector Call Expressions
x->y(123) == x.y(x, 123)
(useful for COM APIs) - Allow
.?
to unwrap any union depending on the inferred context - Remove
using import
not_in
replacednotin
- Relative pointers
#relative(i16) ^Foo
- Relative slices
#relative (i16) []Foo
- Add
"pure"
procedure types - Add new ternary expressions:
x if cond else y
and `x when cond else y - Support by-reference semantics for
for value_ref, i in &some_array
andfor key, value_ref in &some_map
- Allow map indices to be references
&m[key]
and return a valid pointer if exists otherwisenil
- Allow referencing a compound literal
&Foo{}
- Slice literals will use stack memory within a procedure and global memory in a global scope
- Add
-subsystem
flag for Windows - Allow shadowing for
-vet
with immutable parameters @(force)
/@(require)
attributes forforeign import
(they are equivalent)- Endian specific floats, i.e.
f32le
f64be
#optional_ok
for procedures- Improved
odin <command> help
-ignore-vs-search
- Support
--flag
as redundancy for-flag
- Add
-extra-linker-flags:<string>
- Add
#config
to replace#defined
- Restrict
#defined
within procedure bodies to remove possible race conditions - Remove the need for
type_of
,size_of
,align_of
, andoffset_of
to be keywords (now regular identifiers) - Strip
\r
from raw string literals - Experimental Support for WASM
- Add
-target:<string>
with fuzzy checking
Library Improvements
- Improve package os
- Add
package unicode
with basic letter querying - Add
utf8.string_to_runes
andutf8.runes_to_string
- Add more intrinsics (
cpu_relax
,alloca
,type_*
, etc) - Add
#const
to enforce constant procedure parameters to variable parameters - Add
package sys/windows
which will replacepackage sys/win32
in the future - Add more helpers to
package reflect
- Remove
context.stdout/stderr
- Add
package container
- Add more hashes
- More
package sync
features - More
package thread
features - New
mem.Allocator_Mode
sQuery_Features
andQuery_Info
Bug Fixes
- Numerous core library bug fixes
- Fix
defer
related bugs - Fix
__dynamic_array_reserve
edge cases with zero sized types - Improve System V ABI
- Fix name mangling for
@(private)
entities - Fix
time.now()
being one day out on leap years after the leap month
v0.12.0
New Features
- Indexed and ranged fields for array compound literals:
[?]int {0 = 123, 5..9 = 54, 10..<16 = 72}
- Constant compound literals declarations
FOO :: [5]int{1, 2, 3, 4, 5};
#partial switch
- Implement the previous
#complete switch
as the default behaviour
- Implement the previous
- Enumerated Arrays:
[Enum_Type]Value
#partial [Enum_Type]Value
- SOA Arrays, Slices, and Dynamic Arrays
#soa[N]T
#soa[]T
#soa[dynamic]T
- New
#simd
type syntax#simd[N]T
- Add
@(private="file")
and@(private="package")
- Make
string
type elements immutable, akin tochar const *
in C - Allow
#no_bounds_check
on an expression - Deprecate
using import
- Full System V ABI support
- Remove requirement for vcvarsall.bat for Windows. Windows SDK and Binaries are found automatically
- Add
-help
which prints information about the compiler flags - Add
x y z w
fields to quaternion types - Add
r g b a
fields to array typeslen(array) <= 4
alongsidex y z w
fields
Library Improvements
- Improve
package math
- Add
package math/linalg
- Improve runtime/default_allocators.odin
- Make default
context.temp_allocator
thread safe - Add
strings.unsafe_string_to_cstring
- Add
strings.ptr_from_string
- Support
package thread
on unix
Bug Fixes
- Fix string reversal
- Fix linux build
- Fix System V bitcast/transmute bug
- Fix os.write on darwin
- Fix transmute of
uintptr
to/fromproc
- Fix
fmt.string_to_enum_value
- Fix mem.Arena
- Fix using on array in struct
- Fix -no-crt on Windows
- Fix loadsatypos
v0.11.1
New Features
- multivalued procedure calls allows in
for in
to allow a pseudo-iterator @thread_local
for variables in procedure- SOA Struct support
intrinsics.soa_struct
- 128-bit random procedures added to
package math/rand
intrinsics.type_is_unsigned
-show-more-timings
(More in-depth timings)
Bug Fixes
- Fix
linalg,mul
and addlinalg.Matrix1xN
- Fix
linalg.cross3
typo - Fix typeid comparison bug
- Add extra messages for pointer address errors
- Use
runtime.mem_copy
inpackage mem
//+build
system- Fix inline
for
bug for #468 - Fix "Polymorphic parameter declared in return type doesn't compile #464" by giving a conversion error (code wasn't handling polymorphic result types as intended)
- Fix Slice passed incorrectly in LLVM IR to procedure called via procedure pointer #465
- Fix
big_int_or
andbig_int_xor
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 for
loops (only forin
based for loops)
inline for x, i in 1..<4 {
fmt.println(x, i);
}
where
clauses 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)
quaternion128
andquaternion256
- 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_nil
mem.slice_data_cast
#panic
- Add
@force
forforeign import
- Add minor suggestions to errors on casts and assignments
- Change
ODIN_OS
string for macos/osx "osx" to "darwin" to allow for other platforms - Add dummy packages purely for documentation of
builtin
andintrinsics
Updates:
- Type inference improvements for call expressions and procedure group parameters
- Update
package odin_parser
et al. require_results
is now an attribute rather than a suffix tag for procedures- Improved multi-threaded parser
- Change the behaviour of
foreign import
on darwin to be more consistent with other platforms fmt.print*_err
has been replaced withfmt.eprint*
- Consistent
typeid
semantics 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
#complete
switch 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
notin
binary operator formap
andbit_set
types:x notin y
(equivalent to!(x in y)
)
- Endian specific integers
- e.g.
i32
,i32le
,i32be
- e.g.
- Reintroduction of
i128
andu128
- Labels for blocks and if statements (
break
only) - 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
#defined
built-in procedurewhen #defined(FOO) { ... }
- Improved
-vet
- Replace
foreign export
with@export
@private
@static
Experimental Features
odin query
-go-to-definitions
(OGTD file format)-global-definitions
(JSON file format)-compact
(compactify the JSON file)
intrinsics.vector
type
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 switch
for pointers to unions- Allow for single fields
struct #raw_union
- Redefine how union tag size is calculated to match alignment of the union data