Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Pony is an open-source, statically typed, actor-model programming language designed for safe, high-performance concurrency. It was created by Sylvan Clebsch, who began it in 2014 while at Imperial College London and open-sourced it in 2015; the project has since been associated with Microsoft Research. In Pony all concurrency happens through actors that communicate by asynchronous messages, and a system of "reference capabilities" checked by the compiler guarantees there are no data races and that no locks are needed. It is also capabilities-secure: there is no ambient global state, so access to things like the console, filesystem, or network must be handed to code explicitly through the Env object. Programs are compiled ahead of time with an LLVM backend, and on XCODX the reference compiler, ponyc, builds and runs your code.
actor Main
new create(env: Env) =>
env.out.print("Type something, then press Ctrl-D:")
env.input(
object iso is InputNotify
fun ref apply(data: Array[U8] iso) =>
env.out.write(String.from_iso_array(consume data))
fun ref dispose() =>
env.out.print("(end of input)")
end,
512)
Pony is aimed at concurrent, message-heavy systems where correctness and throughput both matter: its type system rules out data races at compile time, and its per-actor garbage collector avoids stop-the-world pauses. It has seen real use in high-performance and stream-processing settings, though its community is small and it remains a niche language. In this sandbox it is a good way to see actors, reference capabilities, and the capabilities-secure Env model on a self-contained example. Because Pony is compiled ahead of time, each run includes a build step, so expect it to start more slowly than the interpreted languages here.
The compiler tracks "reference capabilities" on every variable, which lets it prove at compile time that concurrently running actors cannot race on shared mutable data, without locks. Combined with per-actor garbage collection, this gives data-race-free concurrency by construction rather than by convention.
Reading input is a capability you receive through Env: you call 'env.input(...)' and pass an InputNotify object whose 'apply' method is called with chunks of bytes as they arrive. This is asynchronous and callback-based rather than a blocking read-a-line call, which is unusual compared with most languages. Type into the live terminal / Stdin Box and your notifier receives the data.
Pony is capabilities-secure and has no global variables, so authority to use the console, files, or network is not ambient; it is granted to Main as 'env' and must be passed to whatever needs it. 'env.out.print(...)' is how you write to standard output.
No. There is no dependency manager, no network access, and the filesystem resets every run, so external packages and corral dependencies are unavailable. You can use Pony's standard library and a single source program.
Pony is compiled ahead of time with an LLVM backend, so each run first compiles your code to a native binary and then executes it. That build step, plus a short time limit, means very large programs may not finish in the allotted time.
It is a real, working language that has been used for high-performance and stream-processing systems, but its ecosystem and community are small compared with mainstream languages. Treat it as a specialized niche tool for learning safe, actor-based concurrency.
main.ponyplain text — no highlighter ships for this languageno standard input constructactor Main
new create(env: Env) =>
env.out.print("Hello from Pony!")
env.out.print("Welcome to XCODX Online Compiler!")
The Pony compiler streams each build phase to stdout with no redirection. Those lines are filtered out of the output pane so only your program prints.