(module runtime mzscheme
  (require ""

  (define initial-environment (list global-object))
;  (define current-environment (make-parameter initial-environment))

  ;; make-frame : hash-table -> object
  (define (make-frame table)
    (build-object table))

  ;; TODO: change this to take a string instead
;   (define (dynamic-lookup sym)
;     (fprintf (current-error-port) "looking up ~a in ~v~n"
;              sym
;              (map (lambda (frame)
;                     (hash-table-map (object-properties frame) (lambda (key value) key)))
;                   (current-environment)))
;     (or (ormap (lambda (frame)
;                  (and (has-property? frame (symbol->string sym))
;                       (make-object-ref frame (symbol->string sym))))
;                (current-environment))
;         (make-unknown-ref (symbol->string sym) (lambda ()
;                                                  (raise-reference-error here sym)))))

  (define (initialize-runtime!)
    ;; TODO: initialize the other primitives from
    (install-standard-library! global-object))

  (provide (all-defined)
           (all-from "")
           (all-from ""))
  ;; from
  (provide current-this)
  (provide ref? deref set-ref! delete-ref!)
  (provide object? object-call object-construct object-proto object-class object-table)
  (provide build-object0 object-get object-put! object-keys object-keys* object-keys-stream)
  (provide call)
  (provide completion->value completion->string
           value->boolean value->string value->object value->primitive
           value->number value->integer value->int32 value->uint32 value->uint16)
  (provide true-value?)
  (provide current-completion complete!)
  (provide build-object build-array build-function)
  (provide make-unknown-ref make-object-ref make-array-ref make-lexical-ref make-scope-chain-ref make-arguments-object)
  (provide global-object))