Rebol is a [[Apache v2]] licensed programming language written in [[3. Reference/Software/Programming Languages/C|C]]. - [Website](http://www.rebol.com/) (official but unmaintained) - [Wikipedia](https://en.wikipedia.org/wiki/Rebol) > Although it can be used for programming, writing functions, and performing processes, its greatest strength is the ability to easily create domain-specific languages or dialects ## Rebol 2 First released in 1999. Final official release in 2016 for eglibc Linux (2.7.8.4.10). Closed source and unmaintained since. - [Documentation](http://www.rebol.com/docs/docs.html) (Rebol 2) - [Builds](https://web.archive.org/web/20210901140209/https://www.maxvessi.net/rebsite/Linux/index.php) (unofficial Linux packages, archived 2013) - [Wikibooks](https://en.wikibooks.org/wiki/Rebol_Programming) - [Tutorials](https://web.archive.org/web/20121007020342/http://reboltutorial.com/) (archived 2012) - [Rebol Links](https://www.maxvessi.net/rebsite/wr/) ## Rebol 3 First released in 2008. Final official alpha release in 2012, last commit in 2014, but there are still active forks. - [Website](https://oldes.github.io/Rebol3/) (Oldes' fork, active) - [Source](https://github.com/Oldes/Rebol3) (Oldes' fork) - [Source](https://github.com/rebol/rebol) (official, unmaintained since 2014) - [Builds](https://rebolsource.net/) (officially unofficial builds, unmaintained since 2014) - [Documentation](http://www.rebol.com/r3/docs/index.html) (official, unmaintained) # Notability Discussions about Rebol with [[Brian Hawley]] were hugely influential on my exploration into programming languages and subsequently on my own programming languages. It is essentially a [[Lisp]] that avoids most of its predecessor's parentheses, partially by taking some inspiration from [[Forth]] but mainly just by doing clever arity checking. The resulting language is cleaner and more interesting to me as a result. Has a relatively rich set of core syntactic data types with literals. Due to making s-expressions unnecessary, making DSLs is not only easy but they can look just about however you can imagine. While [[Raku]] has powerful grammars they're difficult to use and integrate and while [[Racket]] is designed for building DSLs it is still an s-expression language and cannot transparently switch between them. Rebol really beats everything, of any language perhaps only Forth and Ruby comes close but they have their own severe limitations. Inspired [[JSON]]. # Philosophy When Carl was working on the language, he prioritized speed and compactness over all else - with a strong nod to stability too. Rebol 2 was an incredibly tiny package with enormous capabilities. Rebol 3 was not as compact, possibly due to simply not having the time to optimize it, but its beta release was still very powerful and small. Rebol 2 was a commercial closed-source product. And used by a few consulting firms and individuals. There are various active forks and descendants of the language now. - Oldes - Attempts to stick to the base principles and style of the original Rebol 3 release - Completely rewrote the build scripts - Actively developed and greatly improved from the initial open source release - Still relatively tight - Hostile Fork - Originally intended for embedding as a scripting language in other programs - Apparently now it is being developed with the goal of targeting [[WASM]] - Heavily modified in style and function from the original - Very large and slow compared to the original or other forks - Re-licensed as LGPL v3 in 2020 for some reason - Primary developer live up to their name ## Derivatives - [[Red]] - https://www.red-lang.org/ - An entirely new language inspired by Rebol, and bootstrapped from Rebol 2 - Attempts to return to a lot of the Rebol 2 paradigms, even when Rebol 3 made clear improvements over them - Funded by investors in China for some reason? - A pseudo-compiled language, even moreso than Go, it mostly just packages up the source with the binary (last I checked) - [[Rye]] - https://ryelang.org/ - A language written in [[Go]], inspired by Rebol - [[Arturo]] - A language written in [[Nim]], inspired by Rebol # Platform Support ## Rebol 3 ### OSes - Linux - Haiku - Mac - Windows ### ISAs - [[x86]] - [[AMD64]] - [[ARMv6]] - [[ARMv7]] - [[ARM64]] - [[MIPS64]] (le) # Features # Data Types ## Errors See also: [[Rebol - Errors]] ## Numbers > Numbers are written as integers, decimals, or scientific notation. > And can also be written in European format ```r 1234 -432 3.1415 1.23E12 123,4 0,01 1,2E12 ``` ## Typesets A typeset is a set of datatypes. > A typeset is simply a compact, high-performance method of storing the datatype sets as a new kind of datatype. Typesets are important because the interpreter uses them to quickly validate function arguments. > > The **typeset!** datatype knows how to convert a block of datatype names such as [integer! decimal! money!] into an internal representation (similar to the bitset datatype). It can also convert the internal format back to a block for output or changes. > > The addition of typesets eliminates the need for the special REBOL pseudo-datatypes like **series!** and **number!**. These are now implemented as typesets, but you can use them the same way as before. They can be used in function argument specifications: ## Refinements A function refinement is defined by a leading slash in the spec block. Arguments listed after the refinement are additional arguments that the function requires if that refinement is applied at the callsite. ```r ;; rebol sum: func [ "Return the sum of two numbers." arg1 [number!] "first number" arg2 [number!] "second number" /times "multiply the result" amount [number!] "how many times" ][ either times [arg1 + arg2 * amount][arg1 + arg2] ] ``` ## Series Types See also: [[Rebol - Series]] A typeset composing a bunch of types which can be treated as an ordered series. ## Blocks See also: [[Rebol - Blocks]] ## Contexts See also: [[Rebol - Contexts]] ## Money Rebol has a dedicated money type. > It is defined as a high precision decimals with denomination (opt). > It is of the general type scalar. ```r $12.34 USD$12.34 CAD$123.45 DEM$1234,56 ``` ## Tuples > Tuples are used for version numbers, RGB color values, and network addresses. They are written as integers that range from 0 to 255 and are separated by dots. ```r 2.3.0.3.1 255.255.0 199.4.80.7 ``` ## Pairs > Pairs are used to indicate spatial coordinates, such as positions on a display. They are used to indicate both positions and sizes. Coordinates are separated by an x. ```r 100x50 1024x800 -50x200 ``` ## Issues > Issues are identification numbers, such as telephone numbers, model numbers, credit card numbers. ```clojure #707-467-8000 #0000-1234-5678-9999 #MFG-932-741-A ``` ## Binary > Binary values are byte strings of any length. They can be encoded directly as hexadecimal or base-64. ```clojure #{42652061205245424F4C} 64#{UkVCT0wgUm9ja3Mh} ``` ## Dates > Dates are written in either international format: day-month-year or year-month-day. A date can also include a time and a time zone. The name or abbreviation of a month can be used to make its format more identifiable in the United States. ```r 20-Apr-1998 20/Apr/1998 (USA friendly) 20-4-1998 1998-4-20 (international) 1980-4-20/12:32 (date with time) 1998-3-20/8:32-8:00 (with time zone) ``` ## Time > Time is written in hours and minutes with optional seconds, each separated by colons. > > Seconds can include a decimal sub-second. Times can also include AM and PM appended without intervening spaces ```r 12:34 20:05:32 0:25.345 0:25,345 12:35PM 9:15AM ``` # Tips ## Building Oldes Fork ```sh siskin ./make/rebol3.nest --clean --update rebol3-bulk-linux-x64 ``` # References - http://rebol.org/ (mostly dead site but has some historical archives) - http://rebol.net/ (mostly dead site but has some historical archives) - http://www.rebol.com/faq.html (old official Rebol FAQ) - https://stackoverflow.com/questions/14818324/what-is-the-summary-of-the-differences-in-binding-behaviour-between-rebol-2-and (2 vs 3) ## Rebol 3 - http://rebol.com/r3/docs/functions.html (incomplete alpha docs) - http://learnrebol.com/rebol3_book.html (Saphir fork) - http://www.rebol.net/r3blogs/0002.html (incomplete alpha blog) ## Rebol 2 - [A Quick Tour of Rebol (official)](http://www.rebol.com/docs/core23/rebolcore-3.html) - http://www.rebol.com/docs/core23/rebolcore-6.html - http://www.rebol.com/docs/core23/rebolcore-9.html#section-3.4 - http://www.rebol.com/docs/words/wcontext.html - http://www.rebol.com/docs/core23/rebolcore-3.html#section-2.4 - http://www.rebol.com/docs/words/win.html - https://en.wikibooks.org/wiki/Rebol_Programming/Advanced/Bindology - https://en.wikibooks.org/wiki/Rebol_Programming/Advanced/Identity - https://en.wikibooks.org/wiki/Rebol_Programming/Advanced/Interpreter - http://blog.revolucent.net/2009/07/deep-rebol-bindology.html