4 ms·
The thing I find the most fascinating about Rebol and Red is their respective type (runtime tag?) systems, which are unusual for modern dynamically typed langua
by networked 12y ago
The thing I find the most fascinating about Rebol and Red is their respective type (runtime tag?) systems, which are unusual for modern dynamically typed languages; today you'd expect such things as URLs and file paths to be represented in the language as either plain old strings or classes, not their own basic types. You can see Rebol's and Red's type systems at http://i.imgur.com/0XFuRmS.png http://i.imgur.com/0XFuRmS.png (this is a slide from a presentation deck on Red's about page) and http://www.rebol.com/docs/core23/rebolcore-16.html http://www.rebol.com/docs/core23/rebolcore-16.html respectively.
- riffraff 12y agoI think the word you're looking for is "literals", i.e. rebol has URL literals (cause there isn't much difference in many modern languages between "basic types" and classes). I always found that fascinating too.
- networked 12y agoYou are probably right. The distinct literal notation for the datatypes (which is what the Rebol manual calls them) is their biggest draw for me. Although the sequence! and the object! datatype in Rebol are not subtypes of each other they have similar semantics (pass by reference, explicit copying, mutation performed in place by built-in functions like sort). Objects in Rebol and their literal representation are actually pretty interesting, too. Douglas Crockford cites Rebol as one of the inspirations for JSON, and you can see why when you look at an example: >> example: make object! [ var1: 10 var2: var1 + 10 var3: now/time set-time: does [var3: now/time] calculate: func [value] [ var1: value var2: value + 10 ] ] >> print mold/all example ; mold/all serializes data #[object! [ var1: 10 var2: 20 var3: 21:42:34 set-time: #[function! [][var3: now/time]] calculate: #[function! [value][ var1: value var2: value + 10 ]] ]] I haven't read much Rebol application code but as far as I understand serializing objects and storing them on disk as plain text is the norm for configuration and persistence.
- laumars 12y agoAfter reading up a little more about Red on Wikipedia, I came across the term "Homoiconicity"[1] which I hadn't encountered before (though the concept itself wasn't new to me, I wasn't aware there was a name for it). What homoiconicity refers to is where the language syntax mirrors the metadata markup - just as you described here with JSON / Javascript. In fact it's a common feature of LISP and it's descendants, Scheme obviously being one. So it's not that surprising that Javascript also inherited homoiconicity from Scheme. The other interesting thing about my research on Wikipedia was the tangent it took me on. I started reading about other other homoiconicity languages that I hadn't heard of; and that lad me to a page about the programming language "Curl"[2] (not related to the cURL HTTP client that most Linux / UNIX sysadmins would be well versed in). Curl is very interesting as it merges the different stacks of web development (markup, style sheets and scripting engine) in a unified language that can still be abstracted separately if one so chooses. Baring the syntax, it was exactly the type of concept I was suggesting a little while back when myself and a few friends were discussing ideal world scenarios of how we'd reinvent the web-development stack. Anyhow, Red is definitely an interesting language in itself. But it's always a bonus when one interesting post on HN leads you on a journey of a few other discoveries. [1] http://en.wikipedia.org/wiki/Homoiconicity http://en.wikipedia.org/wiki/Homoiconicity [2] http://en.wikipedia.org/wiki/Curl_%28programming_language%29 http://en.wikipedia.org/wiki/Curl_%28programming_language%29
- coldtea 12y ago>So it's not that surprising that Javascript also inherited homoiconicity from Scheme. Actually it didn't. Javascript is not homoiconic. JSON just happens to be almost like a homoiconic version of the Javascript array and dict data types, but that stops there. For one, there are some restrictions to what can be valid JSON that are not the same for JS code. And then there are functions etc, which are not in JSON. And the idea that JS is somehow related to Scheme isn't really true (despite being repeated even by Eich). What it has common with Scheme, tons of other languages that nobody will ever say of them to be related to Scheme have. What it doesn't have in common is what makes Scheme scheme. See also: http://journal.stuffwithstuff.com/2013/07/18/javascript-isnt-scheme/ http://journal.stuffwithstuff.com/2013/07/18/javascript-isnt...
- qznc 12y agoMost languages have a URL and File/Path class/struct wrapper. Where is the difference?
- StevePerkins 12y agoI'm not familiar with Red, but my understanding of REBOL is that its main use case is writing domain-specific languages to do the actual work. I can think of many domains in which you would want your DSL to include primitives/literals for files or network URL's. Of course, if Red is not so much a DSL as it is a DSL-authoring language like REBOL, then I share your confusion. For a general purpose language, I'm not sure what the advantage would be of making those primitives/literals rather than components within the standard library.
- dockimbel 12y agoSame reason for Red aswell as for Rebol. There are many more primitive/literals like that, tuple! [1] for example is used to represent RGB colors (255.0.255), ipv4 addresses (192.168.0.1) or even version numbers (2.7.8). Time/Date [2][3] also are basic datatypes with proper literal form. From Rebol console (these types not yet all implemented in Red): >> red + blue == 255.0.255 >> 192.168.100.123 and 255.0.0.0 == 192.0.0.0 >> yesterday: now/date - 24:00 == 15-Nov-2014 >> in-one-year: now + 365 == 16-Nov-2015 >> yesterday < in-one-year == true Rebol provides around 55 datatypes, with a good part of them having a specific literal form. The standard library is actually built-in the language, through this rich set of datatypes (each datatype overloads the basic language functions and operators). You don't need to "import" any of it, it's right there, but almost transparent to the users. The footprint for that is small, the full uncompressed runtime in binary form is about 500KB only. This unusual (but very effective in practice) approach, is one of the features that got me hooked to Rebol in the first place, 15 years ago. [1] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.9 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3... [2] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.2 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3... [3] http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.8 http://www.rebol.com/docs/core23/rebolcore-16.html#section-3...