XCODX |

Pony Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  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.
Success
Operation completed

About Pony

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.

Hello World in Pony

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)

When to use Pony

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.

Common questions

What makes Pony different from other concurrent languages?

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.

How do I read stdin in Pony?

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.

Why do I have to pass env around instead of just printing?

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.

Can I use third-party Pony packages here?

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.

Why is Pony slower to start in this sandbox?

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.

Is Pony production-ready and widely used?

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.

How Pony runs on XCODX

Sandbox filename
main.pony
Entry point
single main source file
Editor grammar
plain text — no highlighter ships for this language
Reading stdin
no standard input construct
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

actor 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.