[racket-dev] chaperones in 5.3.1?

From: Danny Yoo (dyoo at hashcollision.org)
Date: Wed Oct 24 19:19:30 EDT 2012

> I'm hacking into Whalesong to see if I can nail this down more precisely.


Ok, I've got a better test case for you that boils down what I'm encountering.


Here's a set of three files test.rkt, structs.rkt, and builder.rkt:


;; test.rkt
#lang typed/racket/base
(require "structs.rkt")
(require/typed "builder.rkt"
               [make-fresh-constant-1 (-> Constant)]
               [make-fresh-constant-2 (-> Constant)]
               [ensure-symbol-or-vector-value (Any -> (U Symbol
(Vectorof Symbol)))])
(ensure-symbol-or-vector-value (Constant-v (make-fresh-constant-1)))
(ensure-symbol-or-vector-value (Constant-v (make-fresh-constant-2)))


;; structs.rkt
#lang typed/racket/base
(provide (all-defined-out))
(struct: Constant ([v : Any]))



;; builder.rkt
#lang racket
(require "structs.rkt")
(provide make-fresh-constant-1
         make-fresh-constant-2
         ensure-symbol-or-vector-value)

(define (make-fresh-constant-1)
  (Constant (gensym)))

(define (make-fresh-constant-2)
  (Constant #(hello world)))

(define (ensure-symbol-or-vector-value v)
  (cond
    [(symbol? v)
     v]
    [(and (vector? v) (for/and ([elt v]) (symbol? elt)))
     v]
    [else
     (error 'ensure-symbolic-value "Not a symbol or vectorof symbol:" v)]))




Essentially, I'm going from the untyped to typed world when I'm
parsing bytecode with zo-parse, and have helpers to manage that
boundary.  Those helpers no longer are working and are raising
chaperone errors.  What should I do instead?

Posted on the dev mailing list.