[racket] recognizing undefined; shared in TR

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Sat Sep 3 23:17:53 EDT 2011

Is there a way of checking whether a value position is undefined?
Specifically, I'm trying to recognize the undefined value put in
structures by SHARED.  It appears that a undefined value is sometimes
EQ? to another one, but this doesn't seem to be specified in the
documentation (ie, that there is only one undefined value).

Thanks!

==========

Separately, I tried to get inspiration from Typed Racket, but I'm not
sure it works well with SHARED even though it's in the TR language.
To wit:

-----
#lang typed/racket
(define-struct: m ([x : Number]))
(shared ([-a- (make-m -b-)]
         [-b- 3])
  -a-)
-----

produces an error at the binding of -a- saying

  Type Checker: insufficient type information to typecheck. please add
  more type annotations in: -a-

(NB: The error message could use some sprucing up.)

So I instead tried

(shared ([#{-a- : m} (make-m -b-)]
         [#{-b- : Number} 3])
  -a-)

and got several errors:

Type Checker: untyped identifier make-reader-graph imported from
module <scheme/base> in: (shared ((-a- (make-m -b-)) (-b- 3)) -a-)
. Type Checker: untyped identifier make-reader-graph imported from
module <scheme/base> in: (shared ((-a- (make-m -b-)) (-b- 3)) -a-)
. Type Checker: Bad arguments to polymorphic function in apply:
Domain: a ... a
Arguments: Nothing *
 in: (shared ((-a- (make-m -b-)) (-b- 3)) -a-)
. Type Checker: Expression should produce 2 values, but produces 1
values of types Nothing in: (shared ((-a- (make-m -b-)) (-b- 3)) -a-)

Shriram


Posted on the users mailing list.