Quick Summary Presentation of Rebol
Quick Demo
A few demos of Rebol/View to engage your imagination.
Brain Prep
- Rebol is not like any other language (similarities are coincidental)
- Introduced many new ideas now used by other languages
- Resulted from study of every language up to late 1990s
- More than 6 million downloads
- Sold commercial and enterprise products (Rebol-IOS)
- Five books from major publishers
- Strong "cult" following
- Still in use today, some forks exist
- JSON is an offspring (Douglas Crockford)
- Other offspring active development (Red, Ren-C)
Roots of Rebol
Background influences that lead to Rebol, early versions, current versions:
- 1979: HP CSD: Wrote OS scripting language
- 1980: Lisp: MIT Lisp machine
- 1982: Forth: First commercial product on PC
- 1982: MIT RPC: Implemented at HP
- 1983- Smalltalk: Got source from PARC, Sun1
- 1984: TLC Logo: Liaison to John Allen (3rd party)
- 1985: Amiga Exec: "First OOP OS Kernel" (Byte Mag, 1986)
- 1987: C++: Apple ATG (Stroustrup pushed)
- 1986: Smalltalk Revival: Apple ATG (Ingalls, Kaehler, Kay, Tesler)
- 1987: Self OOL: Stanford (Ungar): OOPSLA
- 1989: Amiga Logo (developed): Clean syntax, released product
- 1990: MIME Multimedia Authoring: Used in CDTV demo system
- 1995: MIME2: VideoStream interactive television prototypes
- 1997: REBOL V0: Prototype, founded company, funded
- 1999: REBOL V1: Too slow (internal Lispy/Schemey)
- 2000: REBOL V2: Got 6M downloads, 6 books, still used today
- 2009: REBOL V3: Complete rewrite, open source (on github)
- 20XX: REBOL V4: "Maui," even better, not implemented
Objectives
- Highly expressive (top rated Languages by Expressiveness)
- Greater leverage than OOP/OOL -- mainly via dialects
- Easy to maintain code -- lean and readable
- Small exe size -- 1MB for full version with GUI, crypto, etc.
- Runs everywhere (40 platforms supported)
- Reasonable execution speed -- fast enough not to notice
- Focus on distributed computing -- common exchange language
- Internet protocols built-in: HTTP, FTP, SMTP, POP
- Full crypto support -- SSL, RSA, AES, Blowfish, SHA
- Built-in documentation and help, reflective
Main Concepts
- Write data not code -- for storing and sharing data as well as running code.
- Blocks (arrays) of words, values, and other blocks
- Has a lexicon, but no source syntax, no keywords
- Extensive built-in literal datatypes
- Multiple word forms, bound to context blocks
- Definitional binding (not static, not dynamic)
- Evaluators for functions and dialects
Literal Values
123 - integer 1.23 - decimal (floating point) 1,23 - decimal, alternate $1.23 - high precision (currency) 1.2.3.4 - tuple up to 6 places (versions, colors, IP address) 50x320 - pair for X/Y points 10:23:00 - time (hours, minutes, seconds) 5-4-2015 - date (day, month, year) 2015-4-5 - date (year, month, day) "abc" - string (UTF-8) {abc} - multi-line string (UTF-8) <abc> - markup tag %abc - file, directory, path abc:// - URL/URI me@a.com - email address #1A2B - hex integer #{abc0} - binary hex (byte string)
Examples:
print read http://rebol.com print 10:30 + 2:11 print now - 5-may-1965 print 5-may-1965 + 100 write %system.reb mold system print size? %system.reb help system (various examples)
Words Formats
Words are used for variables, symbols, selectors, and literal values:
abc - a variable in code, or a symbol in data abc: - define a variable (called "set-word") :abc - get value of variable (called "get-word") 'abc - the word as a value (symbol) /abc - selector/refinements for objects, functions, modules
Blocks
Blocks are written with square brackets and contain:
- Literal values
- Words
- Other blocks
Example block:
["Bob Smith" 57 5-May-2018 10:30 http://ibm.com]
Example block with words used as field names:
[ name: "Bob Smith" age: 57 date: 5-May-2018 time: 10:30 mail: bob@email.com site: http://ibm.com ]
This form is often used to create objects.
Example code:
if now/time > 10:30 [print "It's past 10:30"]
With a block you can:
- Access values within the block as data
- Evaluate the block as code
- Interpret the block as a dialect (domain specific language)
Essentially, data and code blocks are the same. The difference is what you do with them.
Dialect Examples
Links to various dialect examples:
Example of not a dialect, but of parse function applied to text: