3 ms·
I agree, interface is arcane but once it clicks... And that may be a problem - world divided by those who grasped that Object.__proto__ === Function.prototype a
by sergeykish 7y ago
I agree, interface is arcane but once it clicks... And that may be a problem - world divided by those who grasped that Object.__proto__ === Function.prototype and other. I've heard similar stories in XSLT land.
What if interface matters? Just recently I've discovered how to clear some confusion:
Object
Object.proto === null
object = new Object
object.proto === Object
object.toString === Object.toString
fun = new Function
fun.proto === Function
It's almost io (just don't touch 'constructor')
Object = Object.prototype
Function = Function.prototype
syntax new = function (ctx) {
let ident = ctx.next().value
return #`new ${ident}.constructor`
}
// bonus point - make it more like io
Reflect.defineProperty(Object, 'proto',
Reflect.getOwnPropertyDescriptor(Object, '__proto__'))
And io is great!