model/action.ss
(module action mzscheme

  (require (lib "plt-match.ss")
           "require.ss"
           "timestamp.ss"
           "pool.ss")
  (require-contracts)
  (require-hierarchy)
  (require-inspector)
  (require-mz:class)

  (define fields/c
    (listof (list/c symbol? any/c)))
  
  (define spec/c
    (or/c
     (list/c (symbols 'new) mz:object? fields/c)
     (list/c (symbols 'call) mz:object? symbol? (listof any/c))
     (list/c (symbols 'return) (listof any/c))
     (list/c (symbols 'get) mz:object? symbol?)
     (list/c (symbols 'set) mz:object? symbol? any/c)
     (list/c (symbols 'inspect) mz:object?)))

  (provide spec/c)

  (with-public-inspector

   (define-hierarchy/provide/contract
     (stack-frame
      ([timestamp timestamp/c]
       [control (optional/c object-handle?)]
       [previous (optional/c stack-frame?)])))

   (define-hierarchy/provide/contract
     (action
      ([timestamp timestamp/c]
       [control-in stack-frame?]
       [control-out stack-frame?])

      (new
       ([object object-handle?]
        [fields (listof (list/c symbol? handle?))]))

      (call
       ([receiver object-handle?]
        [method symbol?]
        [arguments (listof handle?)]))

      (return
       ([values (listof handle?)]))

      (get
       ([receiver handle?]
        [field symbol?]))

      (set
       ([receiver object-handle?]
        [field symbol?]
        [value handle?]))

      (inspect
       ([receiver object-handle?])))))

  )