FAQ

From Reia

Jump to: navigation, search

Contents

How do I write "Hello, world" in Reia?

Like this:

puts("Hello, world!")

"Hello, world" is nice and all, but where are more examples?

There are a number of Reia examples on github. If that's not enough for you, Reia's core types and other core functionality are self-hosted in Reia (look for files with an .re extension)

Why didn't you just adopt Python's / Ruby's / Erlang's syntax outright? This isn't what I'm used to!

Reia isn't Python. It isn't Ruby. It isn't Erlang. It's somewhere in the middle. The syntax must reflect this. Neither Python nor Ruby have pattern matching or receive statements, but Erlang does. Python doesn't have a case statement, but Ruby and Erlang do. Ruby doesn't have list comprehensions, but Python and Erlang do. Ruby has first class regular expressions, and neither Python nor Erlang do.

Reia's syntax is closer to Python and Ruby than it is to Erlang, but the syntax is intended to encompass all the features available in Erlang. This has required compromises such that the syntax for no one of these three languages is suitable for Reia itself.

Why change Erlang's semantics? Isn't the syntax the problem?

Neither are particularly problematic. Erlang's Prolog-inspired syntax can be annoying at times, and there are several projects that aim to fix it, such as Lisp-flavored Erlang and Indentation-sensitive Erlang.

Reia isn't intended to be mere syntactic sugar for Erlang. The goal is to make concurrent, distributed, fault-tolerant programming accessible to those who would otherwise find Erlang difficult to learn. Reia does away with many of the more obtuse semantics in Erlang, including single assignment.

How can you write reliable concurrent programs in an imperative language?

First, Reia is a multiparadigm language which incorporates both imperative and functional ideas, and can't be treated as a strictly imperative language any more than OCaml can be treated as one. Second, the specific design decisions of Erlang are often muddled together under the umbrella of concurrency, however many of them aren't specifically necessary for concurrent programs.

Erlang's secret sauce in regard to concurrency is the use of communicating sequential shared-nothing processes, i.e. the Actor model. This model works equally well regardless of whether a program is functional or imperative.

Single assignment gives Erlang transactional request processing semantics, guaranteed at the language level. This is an incredibly powerful feature which is wonderful for building reliable systems. However, many programs do not need transactionality guaranteed at the language level. For these programs, single assignment is simply annoying, and can reduce conciseness and clarity of code.

Multiple assignment? Gag me with a spoon!

Reia supports the ability to rebind new values to the same varible. This is, to date, the most controversial feature of Reia. While Erlang supports single assignment and prevents variables from being mutated through side effects, Reia makes this possible by abstracting what variables are actually bound to from how they appear to be bound from the programmer's perspective.

This means Reia allows far more side effects than languages like Erlang, and side effects have been long regarded by both functional and concurrent programmers as a nasty source of bugs which should be avoided.

However, most programmers are used to using languages which allow more side effects than Erlang, and furthermore enjoy using operations with side effects to accomplish tasks quickly. While Reia may be more error-prone than Erlang, it will also be more accessible to the average programmer who is not familiar with single-assignment languages and would require a conceptual leap in order to understand them.

Isn't Reia supposed to be a concurrent language? Where's all the concurrency primitives?

Concurrency in Reia is in its infancy. Many have come and searched around the site for the standard Erlang functions for creating processes and receiving messages and found them missing. They will come, but they aren't here for now.

However, concurrency is available in Reia's objects. All objects in Reia are concurrent (except for primitive pseudo-objects like lists, tuples, hashes, numbers, strings, binaries and regexps).

Who is developing Reia?

Reia is a opensource project lead by Tony Arcieri, a software developer from Boulder, Colorado.

Tony's blog is available here: http://tonyarcieri.org

You can follow Tony on Twitter here: http://twitter.com/bascule

You can follow the development of Reia by reading the mailing list.

Personal tools