Indentation sensitivity

From Reia

Jump to: navigation, search

Like Python, Reia uses an indentation-sensitive syntax. This allows Reia to look similar to Erlang without relying on "ant turd" tokens (i.e. , ; and .) to structure relationships between forms. It also eliminates the syntactic clutter of "end" keywords as seen in languages like Ruby. Others have explored making Erlang indentation sensitive, and Reia follows this same approach, albeit with a different language entirely.

Any level of indentation is supported, so long as it's used consistently. However, Python programmers may be used to using hard tabs for indentation. Reia does not presently allow hard tabs whatsoever and requires spaces (i.e. soft tabs) are used instead. If you're encountering errors parsing a file with hard tabs, please locate the necessary tool in your editor to convert tabs to spaces. Future versions of Reia may allow for tabs, however unlike Python mixed usage of tabs and spaces will always be forbidden.

Indentation is used by several features in Reia, including module declarations, function declarations, and multi-line blocks and lambdas.

An excellent discussion about indentation sensitivity can be found at Python: Myths about Indentation.

Personal tools