Safely embeddable, natively multithreaded
Sync is lightweight, being embeddable with a simple API and native support for C, C++, Rust, and Zig. It works on all platforms with a C++17 or higher compiler.
Sync supports running all built code in parallel, without data races and deadlocks. It can utilize all available CPU process power.
Thread safety is memory safety. Sync's ownership model, static typing, and robust synchronization logic guarantees modern, compile-time safety and secure communication with its host program.
Sync uses the C struct memory layout and no garbage collector for seamless data exchange without translation layers. It is deterministic, using move semantics and destructors.
Sync code compiles on demand during runtime, offering maximum program flexibility.
// Mutable global variable
// Compiler enforces thread safety with the `Owned` modifier
mut
counter:
Owned
i32
=
0;
fn
addOne() {
for
i
in
0..10000
{
// Iterates 0, 1, 2, .. 9999
// Acquire a read-write (exclusive) lock
sync mut
counter
{
counter
+=
1;
}
}
}
fn
addTwo(n:
usize) {
for
i
in
0..n
{
// Iterates [0, n)
// Acquire a read-write (exclusive) lock
sync mut
counter
{
counter
+=
2;
}
}
}
fn
main() {
{
const
t1
=
Thread.spawn(addOne);
const
t2
=
Thread.spawn(addTwo,
20000);
}
// Acquire an read-only (shared) lock
sync
counter
{
print(counter); // 50000
}
}
COMING SOON! Necessary primitives, robust error handling, robust synchronization system (including deadlock detection), compiler, and interpreter.
Build a native package manager for Sync for easy sharing and integration. Minimizing supply chain attacks is a top priority.
Both the language server, and clients for popular code editors.
As an embeddable language, supporting all possible targets is a priority. In theory, it should work, but testing must be done.
For platforms that support it, a JIT compiler will push Sync to be the language of choice for extending applications.