Pony (programming language): Difference between revisions

Content deleted Content added
No edit summary
Added mascot of Pony programming language from wikimedia
 
(98 intermediate revisions by 22 users not shown)
Line 1:
{{Short description|Programming language}}
{{AFC submission|d|web|u=RealityDysfunction|ns=118|decliner=SwisterTwister|declinets=20170120192920|ts=20170120190503}} <!-- Do not remove this line! -->
 
{{AFC comment|1=This would've needed all major reviews. [[User:SwisterTwister|<font color="green">'''S'''wister'''T'''wister</font>]] [[User talk:SwisterTwister|<font color="green">talk</font>]] 19:29, 20 January 2017 (UTC)}}
 
----
 
{{Infobox programming language
| name = Pony
| logo = Main_galloping.svg
| paradigm = [[Actor model]]
| paradigm = [[Actor model]], [[object-oriented programming|Object-oriented]], [[Imperative programming|Imperative]]
| designer = Sylvan Clebsch
| designer = Sylvan Clebsch<ref>{{cite web |title=Sylvan Clebsch |website=[[Association for Computing Machinery|ACM]] |url=https://dl.acm.org/profile/83358632257}}</ref>
| influenced by = [[E (programming language)|E]], [[Rust (programming language)|Rust]]
| influenced by = [[E (programming language)|E]]<ref name="gems">{{cite web|author1=Daniele BonettaLuca|author2=Svizzera italiana|author3=Stefan Marr|author4=Walter Binder|url=https://labs.oracle.com/pls/apex/f?p=LABS:0:107979754432222:APPLICATION_PROCESS=GETDOC_INLINE:::DOC_ID:975|title=GEMS: Shared-Memory Parallel Programming for Node.js|quote=Pony is itself inspired by the design of E's programming model|website=oracle|date=2 November 2016|access-date=10 March 2025}}</ref>
| influenced = {{URL|https://www.gitbook.com/book/stw/the-encore-programming-language/details|Encore}}
| influenced = [[Project Verona]]<ref name="zdnetver">{{Cite web|url=https://www.zdnet.com/article/microsoft-opens-up-rust-inspired-project-verona-programming-language-on-github/|title=Microsoft opens up Rust-inspired Project Verona programming language on GitHub|quote="Project Verona, which also borrows concepts from Cyclone, a "safe dialect of C" and Pony, which has key contributors from Microsoft Research"|author1=Liam Tung|website=ZDNet}}</ref>
| latest_release_version = 0.15.0
| released = {{Start date and age|2015|04|28|df=yes}}<ref>{{cite web |title=First public release | website=[[GitHub]] |url=https://github.com/ponylang/ponyc/releases/tag/0.1.0 |date=28 April 2015}}</ref>
| latest_release_date = {{start date and age|2017|08|07}}
| latest_release_version = 0.1559.0
| typing = [[strong typing|strong]], [[static typing|static]], [[type inference|inferred]], [[structural typing|structural]]
| latest_release_date = {{start date and age|20172025|0804|0726}}
| website = {{URL|http://www.ponylang.org}}
| typing = [[strong typing|strong]], [[static typing|static]], [[type inference|inferred]], [[nominal typing|nominal]], [[structural typing|structural]]
| year = {{release date and age|2012|11|09}}
| website = {{URL|http://www.ponylang.org}}
| license = [[BSD licenses|BSD]]-2.<ref>{{cite web | url=https://github.com/ponylang/ponyc/blob/master/LICENSE | title=Ponyc/LICENSE at main · ponylang/Ponyc | website=[[GitHub]] }}</ref>
| programming_language = [[C (programming language)|C]]
}}
 
'''Pony''' (also referred to as '''ponylang''') is a [[Free software|free]] and [[open-source|open source]], object-oriented, [[actor model]], [[Capability-based security|capabilities-secure]], high performance programming language.{{Sfn|Allen|2024}}<ref name="adabeat">{{cite web | date=8 August 2024 |title=Introduction to Actor Model |url=https://adabeat.com/fp/introduction-to-actor-model/ |access-date=8 March 2025 |website=adabeat}}</ref> Pony's reference capabilities allow even mutable data to be safely [[Evaluation strategy#Call by reference|passed by reference]] between actors. [[Garbage collection (computer science)|Garbage collection]] is performed [[Concurrency (computer science)|concurrently]], per-actor, which eliminates the need to pause program execution or [[Tracing garbage collection#Stop-the-world vs. incremental vs. concurrent|"stop the world"]].<ref name="orca">{{cite journal |author1=Sylvan Clebsch | author2=Juliana Franco | author3=Sophia Drossopoulou |date=12 October 2017 |title=Ownership and Reference Counting Based Garbage Collection in the Actor World |url=https://dl.acm.org/doi/10.1145/3133896 |access-date=24 December 2024 |journal=Proc. ACM Program. Lang.| volume=1 | issue=OOPSLA | pages=72:1–72:28 | doi=10.1145/3133896}}</ref><ref name="soc5">{{cite web | publisher=Society 5 Solutions | date=15 October 2024 |title=Introduction to the Pony Programming Language |url=https://www.linkedin.com/pulse/introduction-pony-programming-language-society-5-solutions-llc-s3ppf |access-date=28 December 2024 |website=LinkedIn}}</ref><ref name="dcpony">{{Cite web| author=Daniel Caccamo| year= 2018| title = GoA: Actors with Locally Managed Memory for Go| url= https://uwspace.uwaterloo.ca/bitstreams/b7bb2925-6bd6-49ab-a9b3-bc7581139529/download| access-date=28 December 2024 |website=UWSpace}}</ref> Sylvan Clebsch is the original creator of the language.<ref name="pfintech">{{cite web | author=Charles Humble |date=14 March 2016 |title=Using the Actor-model Language Pony for FinTec |url=https://www.infoq.com/news/2016/03/pony-fintech/ |access-date=24 December 2024 |website=InfoQ}}</ref><ref name="pqc2020">{{cite web |author=Sophia Drossopoulou |date=14 September 2020 |title=Pony, Actors, Causality, Types, and Garbage Collection |url=https://www.infoq.com/presentations/pony-types-garbage-collection/ |access-date=24 December 2024 |website=InfoQ}}</ref> It is now being maintained and developed by members of the Pony team.<ref>{{cite web |title=Team Pony | website=[[GitHub]] |url=https://github.com/orgs/ponylang/people |access-date=28 December 2024}}</ref>
'''Pony''' (often referred to as '''ponylang''') is a [[Free software|free]] and [[open-source|open source]], object-oriented, [[actor_model|actor model]], [[Capability-based_security|capabilities-secure]], high performance programming language. Pony blends together the [[Race condition|race-free]] guarantees of the [[Rust (programming language)|Rust]] programming language, static typing, generics, traits, and the structural typing so well used by the [[Go (programming language)|Go]] programming language. Its reference capabilities<ref>{{cite web | url=http://dl.acm.org/citation.cfm?id=2824816 |title=Deny capabilities for safe, fast actors |authors=Sylvan Clebsch, Sophia Drossopoulou, Sebastian Blessing, Andy McNeil |date=2015-10-26}}</ref> system allows developers to be explicit about how data is shared among components and actors, visually indicating what can and cannot be read from or written to.
 
This allows Pony to reside somewhere between the strict rules of [[Rust (programming language)|Rust]]'s borrow checker and [[Go (programming language)|Go]]'s flexible structural typing while still being able to make race-free and data sharing guarantees.
 
==History==
The language was created by Sylvan Clebsch, while a [[PhD]] student at [[Department of Computing, Imperial College London|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.<ref name="kgpony">{{cite conference |author=Kristoffer Grönlund |date=22 January 2018 | publisher=[[Linux.conf.au|Linux Conference Australia 2018 (LCA2018)]] |title=Everyone gets a pony!| url=https://archive.org/details/lca2018-Everyone_gets_a_pony| access-date=28 December 2024 |website=archive}}</ref>
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.
 
==Language design==
At its core, Pony is a systems language designed around safety and performance.
=== Safety ===
* [[Type safety]] - Pony is a type safe language.<ref name="jmpony">{{cite web |author=John Mumm |date=19 March 2019 |title=Safely Sharing Data: Reference Capabilities in Pony |url=https://talks.codemotion.com/safely-sharing-data-reference-capabiliti |access-date=28 December 2024 |website=codemotion}}</ref>
* [[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.{{Sfn|Allen|2024}}<ref name="atpony">{{cite conference |author=Ankush Thakur |date=21 December 2024 | title=12 New Programming Languages You Should Know| url=https://geekflare.com/dev/new-programming-languages/| access-date=3 January 2025 |website=geekflare}}</ref>
* [[Exception-Safe safety]] - There are no runtime exceptions. All exceptions have defined semantics, and they are always caught.{{Sfn|MCStone|2023}}
* Concurrency safety - The type system employs reference capabilities to ensure (at compile time) that there are no [[Race condition|data races]] nor [[Deadlock (computer science)|deadlocks]].{{Sfn|Mölle|2017}}<ref name="ipony">{{cite web |author=Sean T Allen |date=30 May 2018 |title=Introduction to the Pony programming language |url=https://opensource.com/article/18/5/pony |access-date=28 December 2024 |website=opensource}}</ref><ref>{{cite conference |author1 = Sylvan Clebsch | author2 = Sophia Drossopoulou | author3 = Sebastian Blessing | title = Deny capabilities for safe, fast actors | book-title = AGERE! 2015: Proceedings of the 5th International Workshop on Programming Based on Actors, Agents, and Decentralized Control | date = October 2015 | pages = 1–12 | publisher = Association for Computing Machinery | ___location = Pittsburgh, PA, USA| isbn = 9781450339018 | doi = 10.1145/2824815.2824816 | editor = Elisa Gonzalez Boix, Philipp Haller, Alessandro Ricci, Carlos Varela}}</ref><ref name="soundness">{{cite web|author1=Juliana Franco|author2=Sylvain Clebsch|author3=Sophia Drossopoulou|author4=Jan Vitek|author5=Tobias Wrigstad| url=https://www.doc.ic.ac.uk/research/technicalreports/2018/DTRS18-1.pdf|title=Soundness of a Concurrent Collector for Actors|website=imperial|date=9 March 2018|access-date=8 March 2025}}</ref>
 
=== Performance ===
* Type Safe - Pony is a ''very'' type safe language. For more details on why, check out the mathematical proof<ref>https://www.ponylang.org/media/papers/fast-cheap.pdf</ref>.
* Lock-free - By design, Pony avoids the need for traditional locking mechanisms, which eliminates the overhead and contention associated with locks.<ref name="kgpony"></ref>
* Memory Safe - There are no dangling pointers and no buffer overruns. Like Rust, Pony does not even allow the concept of null.
* Native Codecode - Pony is an [[ahead-of-time (AOT)compilation|ahead-of-time compiled language]]. There is no interpreter or virtual machine{{Sfn|Mölle|2017}}<ref name="atpony"></ref>
* Exception-Safe -There are no runtime exceptions. All exceptions have defined semantics, and they are always caught.
* Concurrent garbage collection - Each actor's heap is collected separately and concurrently, avoiding the need to "stop the world" for global collection.<ref name="pfintech"></ref><ref name="pqc2020"></ref><ref name="soundness"></ref>
* 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.
==Examples==
* 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 [[Foreign function interface|FFI]]
===Hello World===
* Garbage Collected - Each actor's heap is collected separately, there is ''no'' "stop the world" collection.
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.{{Sfn|Allen|2024}}{{Sfn|MCStone|2023}}
 
<syntaxhighlight lang="pony">
actor Main
new create(env: Env) =>
env.out.print("Hello, world!")
</syntaxhighlight>
 
There are no global variables in Pony, meaning everything must be contained within an instance of a class or an actor.<ref name="kgpony" /> As such, even the environment that allows for printing to [[stdout|standard output]] is passed as a parameter.<ref name="kgpony" />{{Sfn|Allen|2024}}
 
==References==
{{Reflist|30em}}
 
== Further reading ==
* {{cite journal |last=Mölle |first=Andreas |date=Dec 2017 |title=Developing concurrent programs with Pony |journal=[[Linux Magazine]] |issue=205 |issn=1536-4674}}
* {{Cite book |last1=MCStone |first1=Maverick |date=Dec 2023 |title=Pony Playbook: Mastering the Basics of Concurrent Programming|publisher=Independently Published|isbn=979-8870768175|language=en}}
* {{Cite book |last1=Allen |first1=Corby |date=Jul 2024 |title=Pony Programming: The Complete Guide to Building High-Performance, Concurrent, and Secure Applications with Pony |publisher=Independently Published|isbn=979-8332662072|language=en}}
 
== External links ==
 
* [http://www.ponylang.org OfficalOfficial website]
* [https://tutorial.ponylang.io/ Ponylang Tutorial]
* [https://medium.com/@KevinHoffman/composition-over-inheritance-in-pony-33bbe107914 Composition over Inheritance with Pony]
* [https://www.infoq.com/interviews/clebsch-pony InfoQ Interview: Sylvan Clebsch on the Actor-Model Language Pony, Garbage Collection, Capabilities, Concurrency]
* [https://www.infoq.com/news/2016/03/pony-fintech InfoQ: Using the Actor-model Language Pony for FinTech]
* [https://www.youtube.com/watch?v=KvLjy8w1G_U Pony: Making it easy to write efficient, concurrent, data race free programs] at [http://curry-on.org/2015/sessions/pony-making-it-easier-to-write-efficient-concurrent-programs.html Curry On 2015] associated with [[ECOOP]] [http://2015.ecoop.org/ 2015]
 
[[Category:Programming languages]]
== Pony (programming language) ==
[[Category:Concurrent programming languages]]
 
[[Category:Multi-paradigm programming languages]]
 
[[Category:Software using the BSD license]]
{{AFC submission|||ts=20170715153954|u=Autodidaddict|ns=118}}
[[Category:Cross-platform software]]
[[Category:Cross-platform free software]]
[[Category:Free and open source compilers]]