Ultraviolet is a general-purpose systems programming language designed to enhance source code legibility and execution predictability. Built for both human and AI use, it emphasizes clear authority and visible behavior, making it ideal for experimentation and contributions. Explore its unique design philosophy and essential tools.
Ultraviolet is a high-performance, general-purpose programming language crafted to enhance human-AI collaboration through explicit authority, predictable execution behavior, and source code readability. This innovative language serves as a powerful tool for both developers and AI systems, ensuring that code remains legible and maintainable.
Ultraviolet encompasses a comprehensive suite, including the language specification, a bootstrap compiler, runtime libraries, and developer tools, as well as a conformance verification suite. While currently in the alpha stage, it invites early experimentation, specification reviews, and contributions to its compiler and runtime.
Ultraviolet is devised around a set of foundational principles aimed at minimizing hidden costs and ambient risks in programming:
Ultraviolet offers a variety of advanced features:
External side effects are managed through an explicit capability handle within the program's context, ensuring controlled I/O operations:
public procedure main(ctx: Context) -> i32 {
let io: $IO = ctx.io
let write_result: Outcome<(), IoError> = io~>write_file(
"output.txt",
bytes::view_string("Hello, Ultraviolet!")
)
return if write_result is {
@Value { 0 }
@Error { 1 }
}
}
Ultraviolet supports modeling of state machines and resource lifecycles directly through its type system:
public modal Connection {
@Closed {
public transition connect(address: string@View) -> @Connected {
return Connection@Connected { address: address }
}
}
@Connected {
public address: string@View
public procedure send(~, data: bytes@View) -> bool {
return true
}
public transition disconnect() -> @Closed {
return Connection@Closed {}
}
}
}
The language introduces arena memory management and frame allocators, allowing efficient resource handling:
public procedure processData() -> i32 {
var sum: i32 = 0
region as scratch {
let temp_array: Ptr<[i32; 3]> = scratch ^ [1, 2, 3]
frame {
let local_val: i32 = ^10
sum = local_val + temp_array[0]
}
}
return sum
}
Ultraviolet features a Static Key System within its type system to manage shared memory, permitting safe concurrent operations:
public procedure worker(counter: shared i32) -> i32 {
var observed: i32 = 0
%write counter {
counter = counter + 1
observed = counter
}
return observed
}
public procedure runConcurrency(context: Context) -> i32 {
var counter: shared i32 = 0
return parallel context~>cpu() {
let task_a: Spawned<i32> = spawn [name: "worker-a"] {
worker(counter)
}
let task_b: Spawned<i32> = spawn [name: "worker-b"] {
worker(counter)
}
(wait task_a) + (wait task_b)
}
}
The repository is logically organized into several sections that streamline access to resources:
The language is available for various platforms, including Linux x86_64, Apple Silicon macOS, and Windows x86_64, with release archives provided for each environment.
Engagement with the Ultraviolet community can be facilitated through GitHub discussions, email for direct support, and following updates on social media. For contributors, guidelines for getting involved are available in the repository.
For more details and comprehensive documentation, please refer to the Ultraviolet GitHub repository.
No comments yet.
Sign in to be the first to comment.