implement $ref, v3 only. v4 should be trivial, but I don't need it yet.