dvanhorn/dpc — Issue #21: State pattern and on-msg in servers is broken
Author: dvanhorn
Created: 2012-02-19 17:00:02+00:00
State: open

If a universe server starts in a state without a `on-msg` method and then transitions to one with an `on-msg`, that method is never called.

Here is a simple client/server that should error once a message is relayed back to the client, instead the `on-msg` method is never called, thus never sending a message back.

```
#lang class/0
(require class/universe)
(require 2htdp/image)

(define-class wait%
(define (on-new iw)
(new begin%)))

(define-class begin%
(define (on-msg iw msg)
(make-bundle this (list (make-mail iw msg)) empty)))

(define-class client%
(define (register) LOCALHOST)
(define (on-tick)
(make-package this 'tick!))
(define (on-receive msg)
(error "Got here!"))
(define (to-draw)
(empty-scene 20 20 "yellow")))

(launch-many-worlds
(universe (new wait%))
(big-bang (new client%)))
```