Category:Onyx (wasm): Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{stub}}{{language|site=https://onyxlang.io/}}
{{stub}}{{language|site=https://onyxlang.io/}}
Onyx is a WebAssembly-first language (`app.wasm`). WebAssembly can be used inside of a browser but is also growing in popularity outside of the browser, in part due to projects like Wasmer, Wasmtime, and WasmEdge. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools.
Onyx is a WebAssembly first language. Onyx aims to make it as easy as possible to start working with WebAssembly. For that reason, Onyx is very well suited for the niche kinds of projects that require using WebAssembly.


Onyx uses a modernized C-like syntax, similar to Jai or Odin. Onyx is an imperative and procedural language in which statements are evaluated in the order they are written in, but does allow for functional-inspired syntax using the pipe operator.
WebAssembly is growing in popularity outside of the browser because of projects like Wasmer, Wasmtime, and WasmEdge that make it easy to run WebAssembly in a controlled environment. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools.

For example:

<syntaxhighlight lang="C">
use core { printf, iter }

main :: () {
for i in 1 .. 10 {
fact := factorial(i);
printf("{}! = {}\n", i, fact);
}
}

factorial :: (n: i32) -> i32 {
return iter.as_iter(1 .. n)
|> iter.fold(1, (x, y) => x * y);
}
</syntaxhighlight>

Latest revision as of 01:59, 12 March 2024

This page is a stub. It needs more information! You can help Rosetta Code by filling it in!
Language
Onyx (wasm)
This programming language may be used to instruct a computer to perform a task.
Official website
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using Onyx (wasm).

Onyx is a WebAssembly-first language (`app.wasm`). WebAssembly can be used inside of a browser but is also growing in popularity outside of the browser, in part due to projects like Wasmer, Wasmtime, and WasmEdge. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools.

Onyx uses a modernized C-like syntax, similar to Jai or Odin. Onyx is an imperative and procedural language in which statements are evaluated in the order they are written in, but does allow for functional-inspired syntax using the pipe operator.

For example:

use core { printf, iter }

main :: () {
    for i in 1 .. 10 {
        fact := factorial(i);
        printf("{}! = {}\n", i, fact);
    }
}

factorial :: (n: i32) -> i32 {
    return iter.as_iter(1 .. n)
        |> iter.fold(1, (x, y) => x * y);
}

Pages in category "Onyx (wasm)"

The following 6 pages are in this category, out of 6 total.