Pony (programming language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Pony
ParadigmActor model, Object-oriented, Imperative
Designed bySylvan Clebsch[1]
First appeared28 April 2015; 11 years ago (2015-04-28)[2]
Stable release
0.59.0 / April 26, 2025; 12 months ago (2025-04-26)
Typing disciplinestrong, static, inferred, nominal, structural
Implementation languageC
LicenseBSD-2.[3]
Websitewww.ponylang.org
Influenced by
E[4]
Influenced
Project Verona[5]

Pony (also referred to as ponylang) is a free and open source, object-oriented, actor model, capabilities-secure, high performance programming language.[6][7] Pony's reference capabilities allow even mutable data to be safely passed by reference between actors. Garbage collection is performed concurrently, per-actor, which eliminates the need to pause program execution or "stop the world".[8][9][10] Sylvan Clebsch is the original creator of the language.[11][12] It is now being maintained and developed by members of the Pony team.[13]

History

[edit | edit source]

The language was created by Sylvan Clebsch, while a PhD student at Imperial College London. His professor at that time was Sophia Drossopoulou, who is also well known for her contributions to computer programming, and as a lecturer. According to developers who have talked to Sylvan, he was frustrated with not having a high performance language that could run concurrent code securely, safely, and more simply.[14]

Language design

[edit | edit source]

At its core, Pony is a systems language designed around safety and performance.

Safety

[edit | edit source]
  • Type safety - Pony is a type safe language.[15]
  • Memory safety - There are no dangling pointers and no buffer overruns. There is no null but optional types can be safely represented using unions with the None type.[6][16]
  • Exception safety - There are no runtime exceptions. All exceptions have defined semantics and are always caught.[17]
  • Concurrency safety - The type system employs reference capabilities to ensure (at compile time) that there are no data races nor deadlocks.[18][19][20][21]

Performance

[edit | edit source]
  • Lock-free - By design, Pony avoids the need for traditional locking mechanisms, which eliminates the overhead and contention associated with locks.[14]
  • Native code - Pony is an ahead-of-time compiled language. There is no interpreter or virtual machine[18][16]
  • Concurrent garbage collection - Each actor's heap is collected separately and concurrently, avoiding the need to "stop the world" for global collection.[11][12][21]

Examples

[edit | edit source]

Hello World

[edit | edit source]

In Pony, instead of a main function, there is a main actor. The creation of this actor serves as the entry point into the Pony program.[6][17]

actor Main
  new create(env: Env) =>
    env.out.print("Hello, world!")

There are no global variables in Pony, meaning everything must be contained within an instance of a class or an actor.[14] As such, even the environment that allows for printing to standard output is passed as a parameter.[14][6]

References

[edit | edit source]
  1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  4. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  5. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  6. ^ a b c d Allen 2024.
  7. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  8. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  9. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  10. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  11. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  12. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  13. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  14. ^ a b c d Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  15. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  16. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  17. ^ a b MCStone 2023.
  18. ^ a b Mölle 2017.
  19. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  20. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  21. ^ a b Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).

Further reading

[edit | edit source]
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
  • Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
[edit | edit source]