Releases: onyx-lang/onyx
Onyx Nightly Release 20260221
This is a nightly release of the Onyx toolchain. Use with caution.
Release 0.1.13
Additions:
- Unwrap operator,
x!.- Similar to try operator (
x?), but panics if value is not present.
- Similar to try operator (
- "Field update" syntax. A shorthand to change a field of a structure.
.{ ..old_value, field = new_value }
onyx watchnow works on MacOS.onyx run-watchto automatically re-run the program on changes.#wasm_sectiondirective to add custom sections to the WASM binary.- Custom commands per project
- Installed in a
.onyxdirectory
- Installed in a
onyx pkg buildcan now run shell commands and multi-stage builds.Stalledcompiler hook to allow for code injection when the compiler stalls.Slice.mapSlice.map_inplaceSlice.fold1Slice.get_optIterator.fromiter.group_bycore.alloc.debugcore.os.argscore.crypto.hmaccore.crypto.keyscore.encoding.json.Value.as_entry_arraycore.encoding.base64 { encode_url, decode_url }core.encoding.xml
Removals:
Changes:
- Capture/closure syntax is now
(params) use (captures) ....(x: i32) use (variable) -> str { ... }(x) use (variable) => { ... }
&&and||now short-circuit.- Fixed-sized arrays (
[N] T) are now passed by value. - The size of tag field for unions is now dependent on the number of variants.
- Parsing structs no longer sometimes needs
#type. - Renamed
core.alloc.memdebugtocore.alloc.memwatch.
Bugfixes:
- Many, many random bugs.
Release: 0.1.12
Additions:
- Ability to pipe into a method call.
x |> y->z() === y->z(x)
- Ability to pipe into a try operator.
x |> y()?=== y(x)?`
- Ability to use
_where#autois used.- This will be come the default soon and
#autowill be removed.
- This will be come the default soon and
return #from_procto return all the way from the procedure.- Variant of
newthat accepts an r-value and places it in the heap. - Builtin
panicprocedure that is equivalent toassert(false, ...) - Format parameter "a" that unpacks an
anyand formats its internal value. --generate-name-sectionCLI flag
Removals:
Optional.tryas it is incompatible with new semantics of?.
Changes:
str.as_stris now preferred overstring.as_strstr.compareis now preferred overstring.comparestr.to_cstr_on_stackis now preferred overstring.to_cstr_on_stackstr.joinis now preferred overstring.join- Implementation of
?forOptionalandResultto return from the enclosing procedure. - JavaScript file generated by
-r jsis no longer an ES6 module.
Bugfixes:
- Fixed WASI compilation due to syntax issue.
- Fixed WASI platform
__file_openimplementation for wasmtime. - Weird edge case when using multiple placeholder arguments in a quick procedure.
Release 0.1.11
Additions:
- Ability specify where piped arguments are placed using
_.x |> foo(y, _) == foo(y, x)
- Alternative syntax for
case #default .... You can now just writecase _ .... - Alternative syntax for binding documentation using
///. - Experimental compiler extensions feature, currently used to create procedural macros.
core.misc.any_deep_copy- Ability to explicitly specify tag value for tagged unions.
Variant as value: type, i.e.Foo as 3: i32
Removals:
- Deprecated the use of
#defaultin case statements. Use_instead. - Removed
iter.take_one. Useiter.nextinstead.
Changes:
There are several breaking changes in this release related to core library APIs.
Iterator.nextnow returns? Tinstead of(T, bool)io.StreamusesResult(T, Error)for return types instead of(Error, T)switchover arangeis no longer inclusive by default, since..=exists now.- Enabled optional semicolons by default.
//+optional-semicolonsis no longer necessary.
There are also several non-breaking changes.
- The internal memory layout is different. See pull request #133 for details.
Release 0.1.10
Additions:
- JavaScript interop
core.jspackage for JS FFI.#jsdirective to build a JavaScript file during compilation.
- Implicit injections
#injectis no longer required in some cases
- Named return values
- Official builds for Linux AARCH64
SliceandArraystructures for placing methods on slices and dynamic arrays.- Range type improvements
range64type..=operator that is a range, with an inclusive upper end.
- New alternate error format that may become the default in the future.
- Use
--error-format v2or set environment variableONYX_ERROR_FORMATto bev2.
- Use
- Auto-disposing locals (experimental)
use x := ...
- Core library functions
- New process spawning API with builder pattern (
os.command) sync.MutexGuardsync.Channelhash.sha1net.dialnet.resolve- integer constants
i8.MIN,i64.MAX, etc.
- New process spawning API with builder pattern (
Removals:
os.with_file
Changes:
- Revamped CLI
- Shorthand commands (r for run, b for build, etc.)
- Improved appearance
- Better help pages
- Note: flags must now appear before all files
- Better error messages for common issues
Arrayshould be preferred overcore.arraySliceshould be preferred overcore.slicestrshould be preferred overcore.string
Bugfixes:
- Fixed compiler crash when trying to iterate over something that is not iterable.
- Fixed wrong implementation of futexes on MacOS.
- Fixed implementation of
platform.__time()
Contributors:
- @Syuparn (1 pull request)
Release 0.1.9
This release has some interesting new features and general usability improvements. It does have a couple rather LARGE syntax changes that will affect nearly every program written in Onyx. The two major syntax changes:
For loops:
for x in array instead of for x: array
Cases with captures:
case Value as capture instead of case capture: Value
Interfaces:
X :: interface (T: type_expr) {
t as T;
}
instead of
X :: interface (t: $T) { ... }
These syntax changes help improve readability and makes the language more friendly to newcomers. These changes also introduce two new keywords into the language that could see use in other places in the future. This is a small improvement to make, but it is better to make it now while a (relatively) small amount of Onyx code has been written.
Additions:
- OVM-Wasm support on MacOS (thanks to @judah-caruso).
- This enables debugging support when on MacOS.
- Available from installer.
.*as a postfix alternative to*.whereclauses can contain arbitrary boolean expressions (thanks to @judah-caruso).- Small arrays (4 or fewer elements) have special accessors for their components.
- Tree-shaking is performed prior to code generation, reducing binary size drastically in some cases.
- Operation overloads for
+,-and*for small arrays. where deferas a cleaner alternative towhere #bottom_testcore.intrinsics.wasm.memory_equalcore.iter.countercore.iter.sumcore.iter.fold1make(List(T))core.list.from_arraycore.list.pop_begin_optcore.list.pop_end_optcore.list.emptycore.conv.parsecore.conv.parse_with_allocatorcore.encoding.json.encode_string_optcore.encoding.json.as_anyoverload
Removals:
- Compiler test cases are no longer shipped with toolchain.
Changes:
- Due to tree shaking, the
methodsmember ofType_Info_StructandType_Info_Unionis not populated by default anymore.- Use the
--generate-method-infoCLI flag to add this information back in.
- Use the
- Due to
asbeing a keyword now,cptr.aswas renamed tocptr.as_unsafe.
Bugfixes:
- Error reporting in many cases saw a lot of improvements.
- Especially with polymorphic procedures, l-values, and code blocks.
- Implementation of
core.array.remove.
Contributors:
- @judah-caruso (10 pull requests)
- @stagas (2 pull requests)
- @magnetenstad (1 pull request)
- @jtakakura (1 pull request)
- @hatappo (1 pull request)
- @Syuparn (1 pull request)
- @benstt (1 pull request)
Release 0.1.8
This is an exciting release! Read more on the Onyx news page!
Additions:
- MacOS compatibility
- Using Wasmer runtime, MacOS on ARM and AMD64 are supported.
- Memory debugger
- A custom allocator that intercepts allocations and frees and reports them
to a client for visualizations and debugging.
- A custom allocator that intercepts allocations and frees and reports them
- New installation script
- sh
<(curl https://get.onyxlang.io -sSfL) - Works on Linux and MacOS
- sh
- KDL document parsing support
- Used as the new format for the package manager.
- See https://kdl.dev for details
os.chdirfor changing the current directory- Supported on WASIX and Onyx runtime
os.getcwdfor getting the current directory- Supported on WASIX and Onyx runtime
- Basic build configurations into package manager.
- Configure sources files, runtime, target file,
included files, and CLI arguments - Multiple configurations per project.
- Build with 'onyx package build <config_name>'
- Configure sources files, runtime, target file,
Removals:
Changes:
- Simplified using union variants of type
void.- Now instead of
.{ Foo = .{} }, use.Fooinstead.
- Now instead of
- Renamed
--no-stdflag to--no-core, since Onyx does not call its standard
library "std", the name did not make any sense. net.make_ipv4_addressnow has a reasonable definition using a string for the IP,
instead of an integer.
Bugfixes:
- Formatting of days and months were incorrect
time.strftime. - Infinite loop in TCP server when a client disconnects.
Release 0.1.7
Release v0.1.7
October 27th, 2023
Additions:
- Support for WASIX, a new, extended standard to WASI, popularized by Wasmer.
- Define
WASIXinruntime.varsto enable it. (-DWASIXon the CLI) - Adds support for networking, futexes, and TTY control in WASI.
- Define
switchexpressions.switchcan appear at the expression level, and usescase X => valueto
specify cases.
cbindgennow supports passing functions as arguments.- Internally uses dyncallback
- Only for OVM-wasm and Linux, for now.
- Scoped values in interfaces.
X :: ...is allowed in an interface now. #injectworks on interfaces.- Polling to the
io.Streamfunctionality.- Used to query when data is read/write-able from a stream, for supported streams.
io.stream_poll
misc.any_unwrapto unwrap ananycontaining an optional.json.decode_with_resultjson.decode_intoslice.group_by
Removals:
Changes:
- Complete overhaul of networking in the core library.
- Backwards compatiblity was not strictly maintained, but common functions did
not change, likesocket_sendandsocket_recv.
- Backwards compatiblity was not strictly maintained, but common functions did
- When debugging,
/ 0or% 0will trigger an exception to debug the error.
Bugfixes:
alloc.atomicpackage was broken whensyncpackage was missing.X.foowould not work ifXwas a pointer to a union.- Captures by pointer would break if the value was a primitive whose address wasn't
taken anywhere else. - Symbol name reported by documentation generation was incorrect for some methods.
Beta 0.1.6
Additions:
- Tagging global variables.
- Just like procedure and structure tags.
- Use
runtime.info.tagged_globalsandruntime.info.get_globals_with_tag()
logffor formatted logging.- This is only present if
conv.formatis present.
- This is only present if
- Ability to debug GC allocator by defining
runtime.vars.Enable_GC_Debug. - Ability to set allocator on
Map. string.to_cstr_on_stackDate.day_of_week()
Removals:
Changes:
misc.any_to_mapnow returns? Map(str, any).- Build scripts on Linux no longer internally use
sudo, requiring the script to be run withsudoinstead.- This makes it possible to easily build Onyx into a container image.
- Parse errors with an unexpected symbol now say the symbol's name instead of TOKEN_TYPE_SYMBOL.
Bugfixes:
alloc.arena.clearwould not leave the arena in a proper state for further allocations.array.filterwas implemented incorrectly.runtime.platform.__get_envwas implemented incorrectly on Onyx runtime.Result.is_okandResult.is_errwere implemented with incorrect return types.Timestamp.from_datewas implemented incorrectly.Date.add_monthswas implemented incorrectly.alloc.atomicwas left untested.Reader.read_byteswas implemented incorrectly.string.last_index_ofwas implemented incorrectly.
Beta 0.1.5
Additions:
- Added ability to control the size of the tag type for tagged unions.
union #tag_type u8
- Infrastructure to have custom sub-commands.
- Any
*.wasmfile in$ONYX_PATH/toolsis available to run withonyx <cmd>
- Any
__futex_waitand__futex_waketo platform layer.- This allows for non-busy-waiting on mutexes and semaphores.
- Currently implemented for Onyx and JS platforms; WASI is impossible, but WASIX will come soon.
--skip-nativeflag toonyx pkg syncto skip compiling native libraries.- Ability to tag methods on structures.
tty_getandtty_setfunctions incore.os- Allows for controlling raw and echoed input
- Currently only for
onyxruntime and on Linux only.
-Dno_entrypointfor programs that do not have amainfunction.
Removals:
Wait_Notify_Availableglobal inruntimepackage.- This is no longer needed as futexes are preferred instead of wait/notify.
Changes:
Bugfixes:
- Fixed bug in
json.encodethat caused arrays of structures to not be outputted correctly. - Fixed bug in
onyx pkgthat causedonyx pkg newto not work as intended.