What You Need to Know About the Roc Programming Language

Time to read
3 minutes
Read so far

What You Need to Know About the Roc Programming Language

Roc is a functional programming language. It’s a newer language, but similar to Haskell in many respects. If you’re looking for a new language to learn, Roc may be well worth your consideration as a compile-to-binary language. It’s very functional and focused on solutions, which works well with those who already have mathematical and engineering capabilities. 

You'll find many similarities to Elm because the company releasing the new programming language is highly familiar with Elm's developer Evan Czaplicki. Roc picks up where Elm stops, helping in use cases that are out of Elm's scope.  

Who Created Roc Programming Language

Richard Feldman took on the task of creating Roc programming language for NoRedInk, working full-time on the project. The language already has 12,660 commits, bringing in experienced contributors to the project. 

The language compiles to machine code rather than JavaScript, making it highly compatible with Elm. Are you interested in checking out whether Roc is right for your developer needs? Roc is not yet released, but should be available anytime. You can get a head start by learning the language now. Here are our top tips for learning and using Roc.

1. Know Elm

Learning Elm helps you utilize Roc on the backend. Since Elm language only works with frontend applications, adding on a compiler such as Roc gives you a chance to work in similar language patterns to complete a full range of functions for an application or website. 

Many programming language experts recommend starting your learning with Python, because the language builds into learning other programming. Roc is similar. If you understand functional programming languages, you’ll pick up Roc much easier. 

Berkley lists Python as a top programming language, pointing to the ability to use different programming styles. For example, you can tap into Python for object-oriented, reflective or functional styles. If you already know Python and Elm, you’re more than ready to learn Roc. 

2. Embrace User Protections

Often, people come to coding as self-learners. Even those who have an education in software development or information technology might have learned much of their coding skills on their own time. 

Some programming languages don’t offer much protection for amateur programmers. For example, you might run JavaScript in a browser and it's fine, but you run the same code as a Node command and you can destroy your computer. Roc offers some protections to keep amateurs from such pitfalls. 

Roc takes the runtime and separates it from the language, so it doesn't execute code automatically without asking first.

3. Improve Readability

Roc is a functional coding language. Many developers find it aesthetically pleasing. Things are laid out in a way that’s easier to read and understand than some other formats. You can read the code from top to bottom and it flows in order with each step laid out for you. The behavior expected and the data separate into different modules. 

If you're used to object-oriented programming, you may have a slight learning curve with Roc. Rather than packaging up data and behavior into a single function, with functional style, you have groups of functions and they are grouped into modules. 

4. Speed Up Processes

You might think C++ is your best programming language because of speed. Roc can be almost as fast. In an interview with Roc contributors, they indicated benchmark testing showed it is as fast as C++ and faster than Go. 

If you’re looking for some low-level, basic programming, Roc can help fill the gap with backend applications. Roc is safer than C because of the built-in protections with the language. Ideally, you might use Roc as an add-on to Elm or some other language, but it can also stand alone. 

5. Test Easier

Another benefit of Roc is that you can pull out different elements and test each function separately to see where you might best improve the application. Rather than testing the entire code at once, you can more easily pinpoint problem areas and perfect one-off functionality. 

By having all your behavior and data in one place, you have fewer issues with different processes conflicting. 

6. Help Develop New Languages

Using new languages helps them become more mainstream. In one of his speeches, Richard Feldman talks about the development of programming languages in general. Technology advanced at such a rapid pace that programming didn't exactly keep up. 

Object-oriented programming has needed replacement for a while, but people were so busy creating and producing they didn't have time to stop and reinvent the wheel. He says there is a paradigm shift coming and then explains languages such as Roc and other functional programming languages. 

The problem with running code on old architecture is that it’s hard to implement big changes. What you are able to do is limited to old functionality. 

Roc Is Almost Ready

Unfortunately, Roc isn’t ready yet. You can watch the videos and learn a bit more about it. You can spend time familiarizing yourself with Elm and other programming languages that might build on Roc. 

At the moment, the language is in development. It is being developed in a private repository. Future users can download the source code, but the developers mention it isn't updated frequently and thus behind what's in the repository as contributors constantly add new things. 

Your best bet is to study what’s being added, play around with the source code, learn functionality programming languages and prepare yourself for when you can tag Roc onto your use of Elm and other languages for a complete and safe programming environment.