This doesn't quite address specifically what you're looking for, but it is somewhat pertinent and it's on my mind so I'll put it here for now.
Having spent a bit of time swimming in the Javascript waters lately, I see some value in a middle ground between Javascript objects and Rebol ports (perhaps this an evolution in thinking since my CLASS proposal).
Ports kind of are the closest thing to a custom Rebol datatype (I'm not the first to suggest this) with some ties to the URL type for something close to top-level representation in the language. Javascript objects go a bit deeper into prototypical inheritance than Rebol objects and have chameleon-like qualities in the way Rebol ports do. Consider how you can, for example, manipulate the way an arbitrary object interacts with standard operators:
function mySpecialNumberType(value, unit) {
this.value = value
this.unit = unit
}
Object.assign(
mySpecialNumberType.prototype, {
valueOf: function () {
return this.value * 2
},
toString: function () {
return '' + this.value + this.unit
}
}
)
let num = new mySpecialNumberType(
1, 'em'
)
console.log(
[num + 2, num]
.join(' ')
)
// => 4 1em
It runs a bit deeper than that and makes Javascript versatile in certain ways—as I said, I think there's some value in that.
A nice quality of Javascript objects is that the object prototypes are named, so it's generally easy to tell if an object conforms to the type you're expecting:
num instanceof mySpecialNumberType
There's no real way to hack 'primitive' objects in Javascript, so you can't change the way, say, a literal 1 or 'foo' is added or formed.
I should add, I do find the way Javascript's objects work in this way a little wacky (by specifying them first by their constructor and then their attributes and obscures their general usefulness
)
If you put aside native IO, PORT! values in Rebol 3 are little more than a variant of OBJECT! and while you can't quite hack the language as in Javascript, you can still manipulate the way various ports react to the standard Rebol verbs, which kind of hints at the general area I'm interested in.