Releases: onyx-lang/onyx
Onyx Nightly Release 20241216
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 watch
now works on MacOS.onyx run-watch
to automatically re-run the program on changes.#wasm_section
directive to add custom sections to the WASM binary.- Custom commands per project
- Installed in a
.onyx
directory
- Installed in a
onyx pkg build
can now run shell commands and multi-stage builds.Stalled
compiler hook to allow for code injection when the compiler stalls.Slice.map
Slice.map_inplace
Slice.fold1
Slice.get_opt
Iterator.from
iter.group_by
core.alloc.debug
core.os.args
core.crypto.hmac
core.crypto.keys
core.encoding.json.Value.as_entry_array
core.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.memdebug
tocore.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#auto
is used.- This will be come the default soon and
#auto
will be removed.
- This will be come the default soon and
return #from_proc
to return all the way from the procedure.- Variant of
new
that accepts an r-value and places it in the heap. - Builtin
panic
procedure that is equivalent toassert(false, ...)
- Format parameter "a" that unpacks an
any
and formats its internal value. --generate-name-section
CLI flag
Removals:
Optional.try
as it is incompatible with new semantics of?
.
Changes:
str.as_str
is now preferred overstring.as_str
str.compare
is now preferred overstring.compare
str.to_cstr_on_stack
is now preferred overstring.to_cstr_on_stack
str.join
is now preferred overstring.join
- Implementation of
?
forOptional
andResult
to return from the enclosing procedure. - JavaScript file generated by
-r js
is no longer an ES6 module.
Bugfixes:
- Fixed WASI compilation due to syntax issue.
- Fixed WASI platform
__file_open
implementation 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
#default
in case statements. Use_
instead. - Removed
iter.take_one
. Useiter.next
instead.
Changes:
There are several breaking changes in this release related to core library APIs.
Iterator.next
now returns? T
instead of(T, bool)
io.Stream
usesResult(T, Error)
for return types instead of(Error, T)
switch
over arange
is no longer inclusive by default, since..=
exists now.- Enabled optional semicolons by default.
//+optional-semicolons
is 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.js
package for JS FFI.#js
directive to build a JavaScript file during compilation.
- Implicit injections
#inject
is no longer required in some cases
- Named return values
- Official builds for Linux AARCH64
Slice
andArray
structures for placing methods on slices and dynamic arrays.- Range type improvements
range64
type..=
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 v2
or set environment variableONYX_ERROR_FORMAT
to bev2
.
- Use
- Auto-disposing locals (experimental)
use x := ...
- Core library functions
- New process spawning API with builder pattern (
os.command
) sync.MutexGuard
sync.Channel
hash.sha1
net.dial
net.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
Array
should be preferred overcore.array
Slice
should be preferred overcore.slice
str
should 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*
.where
clauses 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 defer
as a cleaner alternative towhere #bottom_test
core.intrinsics.wasm.memory_equal
core.iter.counter
core.iter.sum
core.iter.fold1
make(List(T))
core.list.from_array
core.list.pop_begin_opt
core.list.pop_end_opt
core.list.empty
core.conv.parse
core.conv.parse_with_allocator
core.encoding.json.encode_string_opt
core.encoding.json.as_any
overload
Removals:
- Compiler test cases are no longer shipped with toolchain.
Changes:
- Due to tree shaking, the
methods
member ofType_Info_Struct
andType_Info_Union
is not populated by default anymore.- Use the
--generate-method-info
CLI flag to add this information back in.
- Use the
- Due to
as
being a keyword now,cptr.as
was 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.chdir
for changing the current directory- Supported on WASIX and Onyx runtime
os.getcwd
for 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.Foo
instead.
- Now instead of
- Renamed
--no-std
flag to--no-core
, since Onyx does not call its standard
library "std", the name did not make any sense. net.make_ipv4_address
now 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
WASIX
inruntime.vars
to enable it. (-DWASIX
on the CLI) - Adds support for networking, futexes, and TTY control in WASI.
- Define
switch
expressions.switch
can appear at the expression level, and usescase X => value
to
specify cases.
cbindgen
now 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. #inject
works on interfaces.- Polling to the
io.Stream
functionality.- Used to query when data is read/write-able from a stream, for supported streams.
io.stream_poll
misc.any_unwrap
to unwrap anany
containing an optional.json.decode_with_result
json.decode_into
slice.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_send
andsocket_recv
.
- Backwards compatiblity was not strictly maintained, but common functions did
- When debugging,
/ 0
or% 0
will trigger an exception to debug the error.
Bugfixes:
alloc.atomic
package was broken whensync
package was missing.X.foo
would not work ifX
was 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_globals
andruntime.info.get_globals_with_tag()
logf
for formatted logging.- This is only present if
conv.format
is 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_stack
Date.day_of_week()
Removals:
Changes:
misc.any_to_map
now returns? Map(str, any)
.- Build scripts on Linux no longer internally use
sudo
, requiring the script to be run withsudo
instead.- 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.clear
would not leave the arena in a proper state for further allocations.array.filter
was implemented incorrectly.runtime.platform.__get_env
was implemented incorrectly on Onyx runtime.Result.is_ok
andResult.is_err
were implemented with incorrect return types.Timestamp.from_date
was implemented incorrectly.Date.add_months
was implemented incorrectly.alloc.atomic
was left untested.Reader.read_bytes
was implemented incorrectly.string.last_index_of
was 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
*.wasm
file in$ONYX_PATH/tools
is available to run withonyx <cmd>
- Any
__futex_wait
and__futex_wake
to 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-native
flag toonyx pkg sync
to skip compiling native libraries.- Ability to tag methods on structures.
tty_get
andtty_set
functions incore.os
- Allows for controlling raw and echoed input
- Currently only for
onyx
runtime and on Linux only.
-Dno_entrypoint
for programs that do not have amain
function.
Removals:
Wait_Notify_Available
global inruntime
package.- This is no longer needed as futexes are preferred instead of wait/notify.
Changes:
Bugfixes:
- Fixed bug in
json.encode
that caused arrays of structures to not be outputted correctly. - Fixed bug in
onyx pkg
that causedonyx pkg new
to not work as intended.