AltME: Ren - Data Exchange Format


In Ren, it may be very useful to restrict potential keys slightly further, to ease interop with other languages.
For full Rebol, we could have slightly more relaxed restrictions.
In particular, I think that compound types as keys should be carefully considered for Ren.
Yes, Ren is separate, and not only good for interop, but also a helpful constraint to require keys to be set words.
Compound types: blocks, (parens?), maps.
Potentially helpful. It's a tough call, because we think in terms of Redbol, and want to exchange all data seamlessly.
Agreed on compound types.
Enormous power there, if you allow anything.
And enormous potential for problems as well, because you then need to carefully define a equivalence story as well.
But I think for primitive types, most if not all of them should be allowed as keys.
And much more complex for interop, as you said.
I also think that a relaxed restrictions on keys may actually be something of a "selling point" for Ren.
JSON decidedly represents "objects", which entails strong restrictions. But in practice, most implementations don't really exchange "objects" through JSON, but rather a generic associative datastructure (maps, hashtables, dictionaries). Also, because JS objects don't really fit that closely to objects in other languages.
So if we start with maps instead of objects in the first place, with relaxed restrictions on keys, we have a much closer fit to reality than JSON does.
Lua comes to mind, because anything can be a key in a table, correct?
And the complexity of allowing them is offset by the consistency.

"Ren spec needs to be kept a simple as possible, while still allowing much more expressivity than JSON."
So you should first of all not think about map! datatype, and use block! (without set-words) or object! (if you want set-words as keys), but map! with just set-word! key is a nonsense.
One of real life examples why to use map! (or hash!) instead of block! or object! would be unicode collation - I don't see any usage there for set-word! keys. But I probably don't understand the main purpose of REN :-)
Actually, it doesn't matter that much, if it is map! or object! -- the thing is not to write "make map! [...]" or "make object! []" in REN (or use construction syntax). It should be simple and usable by people who do not know anything about Rebol.

Last message posted 242 weeks ago.