Jump to content

Draft:Pony (programming language): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Added the Ponylang mascot, "Main".
mNo edit summary
Line 18: Line 18:
| year = {{release date and age|2012|11|09}}
| year = {{release date and age|2012|11|09}}
| license = [[BSD licenses|BSD]]-2.<ref>https://github.com/ponylang/ponyc/blob/master/LICENSE</ref>
| license = [[BSD licenses|BSD]]-2.<ref>https://github.com/ponylang/ponyc/blob/master/LICENSE</ref>
| file ext = .pony
| programming_language = [[C (programming language)|C]]
| programming_language = [[C (programming language)|C]]
}}
}}

Revision as of 17:58, 20 June 2024


Pony
ParadigmActor model, Imperative
Designed bySylvan Clebsch
First appearedNovember 9, 2012; 12 years ago (2012-11-09)
Stable release
0.58.5 / June 1, 2024; 6 months ago (2024-06-01)
Typing disciplinestrong, static, inferred, nominal, structural
Implementation languageC
LicenseBSD-2.[1]
Websitewww.ponylang.org
Influenced by
E
Influenced
Encore, Project Verona[2], Savi, Inko

Pony (sometimes referred to as ponylang) is a free and open source, object-oriented, actor model, capabilities-secure, high performance programming language. Pony blends together race-free guarantees, static typing, generics, nominal typing, and structural typing. Its reference capability[3] system allows developers to be explicit about how data is shared within and between actors.

Language design

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

  • Type Safe - Pony is a type safe language. For more details on why, check out the mathematical proof[4]
  • Memory Safe - There are no dangling pointers and no buffer overruns. There is no null but optional types can be represented using unions with the None type.
  • Exception-Safe -There are no runtime exceptions. All exceptions have defined semantics, and they are always caught.
  • Data-race Free - Pony does not have locks or atomic operations. Instead, the type system ensures at compile time that your concurrent program can never have data races. This allows developers to write highly concurrent code with less change of problems occurring in the use of concurrency primitives.
  • Deadlock-Free - Pony lacks language-level constructs to create locks. It is impossible to write code that compiles that will produce a deadlock.
  • Native Code - Pony is an ahead-of-time (AOT) compiled language. There is no interpreter or virtual machine
  • Compatible with C - Interop with C is enabled through FFI
  • Garbage Collected - Each actor's heap is collected separately, there is no "stop the world" collection.

Examples

A few examples of idiomatic Pony follow.

Hello World

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.

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

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

History

In 2011, Sylvan Clebsch created a C-based actor library in order to solve some real problems for software he was creating. Ultimately this library became the first implementation of Pony in 2012.

References

  1. ^ https://github.com/ponylang/ponyc/blob/master/LICENSE
  2. ^ "Verona FAQ". Github.
  3. ^ "Deny capabilities for safe, fast actors". 2015-10-26. {{cite web}}: Unknown parameter |authors= ignored (help)
  4. ^ https://www.ponylang.org/media/papers/fast-cheap.pdf