[racket] Adding contracts to frtime/core/dv.rkt produces errors

From: Patrick Mahoney (paddy.mahoney at gmail.com)
Date: Thu Aug 23 16:38:33 EDT 2012

Hello all,

I am attempting to do some further work on the frtime lang. Specifically,
I'm working out of a branch based on the pull request
https://github.com/plt/racket/pull/138 - this new branch is the
frtime-contracts branch.
Link to frtime-contracts branch:

 In this library, I am beginning to add contracts. I've begun with the file
(define vec-length/c natural-number/c)

(define vec/c vector?)

(define vec-pos/c natural-number/c)

(define dv/c (struct/dc dv
                        [vec-length vec-length/c]
                        [next-avail-pos (vec) (and/c natural-number/c (<=/c
(vector-length vec)))]
                        [vec vec/c]))

(define dv:length/c (-> dv? natural-number/c))

(define dv:make/c (-> natural-number/c dv?))

(define dv:remove-last/c (-> dv? void))

(define dv:ref/c (->i ([a-dv dv?]
                       [pos (a-dv) (and/c (<=/c (dv:length a-dv)
                      [_ any/c]))

 (contract-out [dv? (any/c . -> . boolean?)]
               [dv:make dv:make/c]
               [dv:length dv:length/c]
               [dv:remove-last dv:remove-last/c]
               [dv:ref dv:ref/c]))

 #;[dv? (any/c . -> . boolean?)]
 #;[dv:make (exact-nonnegative-integer? . -> . dv?)]
 #;[dv:length (dv? . -> . exact-nonnegative-integer?)]
 #;[dv:remove-last (non-empty-dv? . -> . void?)]
 #;[dv:ref (->d ([dv dv?] [pos exact-nonnegative-integer?]) ()
              #:pre-cond (pos . < . (dv:length dv))
              [r any/c])]
 [dv:set! (->d ([dv dv?] [pos exact-nonnegative-integer?] [val any/c]) ()
               #:pre-cond (pos . < . (dv:length dv))
               [r void])]
 [dv:append (dv? any/c . -> . void)])

Upon running the analog-clock.rkt demo in the frtime/demos folder, I
receive the following errors:

module-path-index-resolve: "self" index has no resolution
  module path index: #<module-path-index>
. Module Language: invalid language specification in: frtime/frtime-big

Another error that arises is:
define-values/invoke-unit/infer: unknown signature in: graphics:posn-less^

Removing the (provide (contract-out ...)) form in favor of the original
(provide/contract* ...) form with the comments removed resolves the errors.
What can I do to resolve these errors with the contracts enabled? I tried
enabling individual contracts, but the errors still occurred. I don't doubt
that there could be errors in the contracts, but there don't appear to be
any contract violations that I see when running in Dr.Racket.

Instructions to Reproduce
1. Open a command line and:
> git clone https://github.com/paddymahoney/racket.git
(you might want to do this in a different directory than that which holds
another fork of racket)
> git checkout frtime-contracts
3. Open the "racket/collects/frtime/
develop-frtime.rkt" file in drracket and update the two paths.
4. Run the function (start-developing-frtime) to ensure that the
development rather than installation collection is used when we run the
demos. If you don't, any collection paths will refer to the install
directory, and you will receive errors.
5. Open "racket/collects/frtime/demos/analog-clock.rkt. Run it in Dr. Racket

Please let me know if you require any further assistance reproducing this
bug, and I will endeavor to provide.

Thank you all,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120823/18d721bf/attachment.html>

Posted on the users mailing list.