A pure function describes a pure computation. Given the same inputs and context, it always produces the same result, without modifying external state or producing observable side effects.
The same computation can support previews, simulations, and tests, and directly inform decisions during execution.
Inputs determine the result. A pure function only computes and returns a value. It neither reads hidden state nor changes the outside world.
Start with pure computation.
Fewer capabilities mean less state to reason about.
pure functions depend only on their inputs and return results, making them easier to reuse, test, parallelize, and optimize. Use const when you need to interact with external state while guaranteeing that this stays unchanged. Use mut only when you need to change the object. If you prefer, use auto and let the implementation determine the capabilities it needs.
doubled reads the current value and returns twice that value. It only computes, without changing the object or producing external side effects.
Output the current value
constfunreport() {
println(value)
}
report needs to produce output, but does not need to change the current object. It receives only the capabilities it needs.
Reset object state
mutfunreset() {
value = 0
}
reset sets the current object’s value to zero. When an operation needs to change the object, mut makes that capability explicit.
Let the implementation decide
autofunnext(): Int {
return value + 1
}
next only reads value and returns a result, so it can be inferred as pure. The compiler determines the required capabilities from the implementation.
Compilation targets · Planned
One codebase. Different runtimes.
Jvav plans to support compilation to native code, .NET, JVM, and other targets. Choose the runtime that suits your project without switching languages, rewriting your core logic, or learning a different semantic model.
Language features such as pure, access capabilities, and state transitions will remain consistent across compilation targets.
Jvav is under active design. Complete member classifications and multi-target backends remain in development planning; open questions in the current draft remain pending.
The Jvav specification.
Explore Jvav’s syntax, types, and evaluation rules. The working draft explains how values, effects, and state transitions behave, with definitions and examples.