Draft:Roc (programming language)
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources
|
| Roc | |
|---|---|
| Paradigm | Purely functional, statically typed |
| Designed by | Richard Feldman |
| Developer | Roc Team |
| First appeared | 2018[1] |
| Stable release | Alpha 4
|
| Typing discipline | Inferred, static, strong |
| Implementation language | Rust, Zig |
| License | Universal Permissive License (UPL-1.0) |
| Website | www |
| Major implementations | |
| Roc Compiler | |
| Influenced by | |
| Elm | |
Roc is a purely functional, statically typed, general-purpose programming language that compiles to binary.[2] It aims to bring purely functional programming to areas traditionally dominated by imperative languages, such as command-line tools, web servers, and scripts.[3][4]
Created by Richard Feldman, the language features a unique architecture that separates the application logic from the underlying runtime environment (referred to as the "Platform").[5]
History
Roc was created by Richard Feldman, who is also known for his work in the Elm community and as the author of Elm in Action from Manning Publications.[6] The language began development to address the lack of a purely functional language that offered both the developer experience of Elm and the performance characteristics required for backend and systems software.[7]
The language is in an alpha state. In early 2025, Feldman announced that the team had begun rewriting the compiler from Rust to Zig.[8] The development roadmap focuses on stabilizing the compiler, expanding the ecosystem of platforms, and implementing an editor-agnostic language server.[9]
Design and features
Performance and memory management
Roc compiles directly to machine code (or WebAssembly) rather than running on a virtual machine (VM) or transpiling to another high-level language.[10]
Unlike many functional languages (such as Haskell or OCaml) or managed languages (like Java), Roc does not use a tracing garbage collector. Instead, it utilizes automatic reference counting. The compiler inserts instructions to free memory immediately when a variable is no longer in use. To optimize performance, Roc employs "in-place mutation" optimizations: if the compiler detects that a data structure is being updated and its reference count is one (meaning it is unique), it will mutate the memory in place rather than allocating a new copy. This allows the language to remain purely functional semantically while potentially achieving performance characteristics similar to imperative languages.[10]
Platforms and Applications
A distinctive feature of Roc is its separation of code into "Applications" and "Platforms."[3]
- The Application contains the core logic of the program. It is written in Roc and is purely functional.
- The Platform is a domain-specific compilation framework. It acts as as interface between the application and the operating system and allows code compilation to be optimised for the given domain. It provides low-level primitives for I/O, memory management entry points, and standard library features appropriate for the target.[11] So far the two main supported platforms are a web server platform and a CLI platform, and potential future platforms may include a game engine platform and a GUI platform.[12]
Platforms are often written in low-level languages like Rust, Zig, or C, though they expose a Roc interface to the application.
Developer experience
Roc places a heavy emphasis on "friendliness," largely inspired by Elm. This includes helpful compiler error messages that suggest fixes, a built-in test runner, and a formatter. The type system uses type inference, allowing developers to omit type annotations in most cases while maintaining static type safety.[13]
Syntax and semantics
Roc's syntax was influenced by Elm but has now developed its own distinctive functional style.[14]
Functional patterns
Roc supports standard functional programming patterns, including:
Error handling
Roc does not use exceptions. Instead, it uses an algebraic data type (containing either an `Ok` value or an `Err` value) for operations that can fail.[17]
See also
References
- ^ "Funding the Roc Programming Language". NoRedInk. Retrieved 2024-01-17.
- ^ https://www.techtarget.com/searchapparchitecture/tip/Understanding-Roc-Functional-and-separate-from-the-runtime
- ^ a b "Roc Programming Language". roc-lang.org. Retrieved 2023-10-27.
- ^ "What You Need to Know About Roc Programming Language". SocPub. Retrieved 2024-01-17.
- ^ "Intro to Roc: Innovation in Functional Programming". GOTOPIA. Retrieved 2023-10-27.
- ^ "Roc – Richard Feldman, Creator of Roc". Rust in Production Podcast (Podcast). corrode Rust Consulting. 13 November 2025.
- ^ Lamacraft, Robin. "Why Roc Could Be The First Mainstream Purely Functional Language". Retrieved 2023-10-27.
- ^ https://gist.github.com/rtfeldman/77fb430ee57b42f5f2ca973a3992532f
- ^ "Roc Plans and Roadmap". roc-lang.org. Retrieved 2023-10-27.
- ^ a b "Fast". roc-lang.org. Retrieved 2023-10-27.
- ^ "Introduction to Roc Programming Language by Richard Feldman". Ada Beat. Astrid Dagny Alva Beat AB. May 8, 2024.
- ^ https://www.roc-lang.org/platforms
- ^ "Friendly". roc-lang.org. Retrieved 2023-10-27.
- ^ "Roc Syntax Example". GitHub. Retrieved 2023-10-27.
- ^ "Functional". roc-lang.org. Retrieved 2023-10-27.
- ^ "Pattern Matching Example". roc-lang.org. Retrieved 2023-10-27.
- ^ "Error Handling Basic". roc-lang.org. Retrieved 2023-10-27.
External links
Category:Programming languages Category:Functional programming languages Category:Statically typed programming languages
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.

- provide significant coverage: discuss the subject in detail, not just brief mentions or routine announcements;
- are reliable: from reputable outlets with editorial oversight;
- are independent: not connected to the subject, such as interviews, press releases, the subject's own website, or sponsored content.
Please add references that meet all three of these criteria. If none exist, the subject is not yet suitable for Wikipedia.