Getty Images

Tip

Understanding Roc: Functional and separate from the runtime

Though it's a newer programming language with a small development community, Roc is meant to be an easy-to-read language that incorporates a pure, functional programming approach.

Roc is a functional, compile-to-binary programming language that introduces a new layer of abstraction into the technology stack. The language offers a statically typed system to simplify refactoring, build low-level applications and support embedded systems. It also offers some key capabilities associated with functional programming, such as isolation of code and separation of behavior and data.

This article reviews some of the standout qualities and features of the Roc programming language -- both good and bad -- that interested developers may benefit from knowing about.

Simplified code

As a statically typed language, Roc can help programmers be more concise in their code and generate less verbose scripts. Programmers using Roc can also isolate code and script segments during refactoring to minimize the time spent searching through a codebase to fix updates. Roc relies on data types and collections of functions that reside within modules, which helps programmers write clear, defined code instructions.

Roc's syntax focuses on readability and enabling programmers to understand what's occurring in their source code. As a direct descendent of the Elm programming language, one of the goals of Roc's creators is to design a customized editor that surpasses the experience developers currently have working with Roc in general-purpose editors, such as Vim or Visual Studio Code.

Separation from the runtime

The Roc programming language relies on a low-level VM platform to compile simultaneously to multiple CPU architectures, subverting the need to be bound to a single runtime. By separating runtimes, the language also helps programmers readily deploy code on different processor platforms, such as 32-bit, 64-bit, Arm and Intel. Roc code can also compile to server-side WebAssembly for cloud-based code, high-performance application builds and back-end communication channels, as well as other complex development projects.

Simplified data types

Concrete data types in the Roc programming language consist of simple structs and primitives, which help to further simplify testing. Instead of testing the entire codebase, programmers can isolate different code elements and test each function separately to pinpoint problems, ensure consistency and calibrate application performance on a modular level.

A highly computational language

Transparency in readability and formatting of Roc code means programmers can follow the instructions within their codebase. Roc shares a lot in common with Haskell and Elm, such as a focus on mathematical computations. Beginners who have mathematical, engineering or functional programming capabilities are in the best position to learn Roc. Otherwise, it may be best for new programmers to become familiar with Python and Elm before learning Roc.

Potential downsides of Roc

Roc is still a nascent language. While its creators offer a permissive open source software license, the repository is not yet fully public. As it stands, Roc's standard library is only partially complete, and testing efforts on its compiler are still in early stages. Some brief tutorials are available on the language's official website. However, since Roc is still in development within a private repository, novice programmers who want to try the language may face hurdles getting started in the absence of a thoroughly established developer support community.

Dig Deeper on Application development and design