4 ms·
You 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
by networked 12y ago
You 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...
- laumars 12y agoThat article states that Javascript isn't Scheme, which is a point I never argued (I think you've read far too much into my "inheritance" point). Javascript was inspired by Scheme, and obviously other languages as well. Since we're referencing Eich, he has also personally talked[1] about how he was hired at Netscape to write a Scheme for the browser and how he later developed a new language with ideas borrowed from Scheme (as well as Self, TCL and a few other languages IIRC). Thus there are obviously going to be some inheritance from Scheme in Javascript; even if they are conceptually very different languages and even if those qualities inherited are also shared amongst a multitude of other languages. You see, something doesn't have to be exactly like, nor even uniquely like, to still have inheritance. Much like how derivative works in art where the predecessor stands up as an original piece - separate from the parent's vision - despite sharing the same lineage. Such is the beauty of derivative works - you can take inspiration from the preceding material yet still invent something different. So that's what I meant when I said that Javascript inherited homoiconicty from Scheme (though obviously I was wrong about Javascript being homoiconic itself - and I thank you for that correction) [1] http://brendaneich.com/2008/04/popularity/ http://brendaneich.com/2008/04/popularity/
- coldtea 12y ago