[plt-scheme] Contract changes a parameter-procedure to a procedure. Why?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri Apr 16 13:30:43 EDT 2010

I had the bright (?) idea of specifying a contract for a parameter. But:

#lang scheme

(define p1
  (make-parameter #f))

(parameter? p1) ; --> #t
p1 ; --> #<procedure:parameter-procedure>

(define/contract p2
  (() (boolean?) . ->* . (or/c boolean? void?))
  (make-parameter #f))

(parameter? p2) ; --> #f   Why?
p2 ; --> #<procedure>      Why?

I discovered this when I made a contract for a procedure that requires
its argument to be a parameter. I can't use parameter? I'd have to
settle for procedure?.

Is this because the contract is implemented as a wrapper procedure,
and the parameter? predicate only sees the contract wrapper procedure
not the parameter-procedure inside?


Posted on the users mailing list.