23 lines
746 B
Scheme
23 lines
746 B
Scheme
#lang scheme/base
|
|
(require scheme/class)
|
|
(provide (all-defined-out))
|
|
|
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
; a message for sending betwixt logic and view side
|
|
(define-serializable-class* message% object% ()
|
|
(init-field
|
|
(name 'none) ; a symbol denoting the type of the message
|
|
(data '())) ; should be an assoc list map of name to values, eg:
|
|
; '((name "archibold") (age 53))
|
|
; shouldn't put logic objects in here - 'raw' data only
|
|
|
|
(define/public (get-name)
|
|
name)
|
|
|
|
(define/public (get-data arg-name)
|
|
(cadr (assoc arg-name data)))
|
|
|
|
(define/public (print)
|
|
(printf "msg: ~a ~a~n" name data))
|
|
|
|
(super-new))
|