scope {
    var obj = object{}
    assert !obj.hasOwnProperty('foo')
    obj.prototype.foo = 1
    assert !obj.hasOwnProperty('foo')
    assert obj.prototype.hasOwnProperty('foo')
    assert 1 === obj.foo
    assert !obj.hasOwnProperty('foo')
    obj.foo = 3
    assert obj.hasOwnProperty('foo')
    assert obj.prototype.foo !== obj.foo
    unset obj.foo
    assert !obj.hasOwnProperty('foo')
    assert 1 === obj.prototype.foo
    assert 1 === obj.foo
}

scope {
    const ob2 = object{
        g:proc(){
            return this
        }
    }
    const obj = object {
        f:proc(){
            return this.g
        },
        g:proc(){
            print("G!", this);
            return this
        },
        h:proc(){
            return ob2
        }
    }
    assert obj.g === obj.f()
    assert obj.g === [obj.f]
    $print 'f =' obj.f ', g =' obj.g ', f() =' obj.f() ', g() =' obj.g()
    $print '[[obj.f]] =' [[obj.f]] ', f()() =' obj.f()()
    assert obj.g === [[obj.f]]
    assert obj === obj.g()
    assert ob2 === obj.h().g()
}
