I'm confused about why the following program is blaming the server for the
client's misuse of an applicable struct instance. More generally, I've
tried doing this in several different ways, and I can't figure out how to
make applicable structs that are still protected by contracts after
deserialization and blame the client module for misusing them.

Thanks,
Philip

#lang racket

(module server racket
  (require racket/serialize)
  (provide (contract-out
            [adder (-> natural-number/c (-> natural-number/c
                                            natural-number/c))]))
  (struct adder (base)
    #:property prop:procedure
    (λ (this x)
      (+ (adder-base this) x))
    #:property prop:serializable
    (make-serialize-info (λ (this) (vector (adder-base this)))
                         #'deserialize-info:adder-v0
                         #f
                         (or (current-load-relative-directory)
                             (current-directory))))
  (define/contract make-adder
    (-> natural-number/c (-> natural-number/c
                             natural-number/c))
    adder)
  (define deserialize-info:adder-v0
    (make-deserialize-info make-adder
                           (λ () (error 'adder
                                        "can't have cycles"))))
  (module+ deserialize-info
    (provide deserialize-info:adder-v0)))


(require 'server racket/serialize)

((deserialize (serialize (adder 5))) 'not-a-number)

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to