In the Racket version 7.0 on Windows, a contract violation error in an
executable program will trigger a very confusing error message.  I think 
this
is best illustrated by an example.  Consider the file:

    #lang racket
    (require racket/contract)

    (define/contract (foo n)
      (-> integer? any/c)
      (printf "foo: ~a~%" n))

    (module+ main
      (foo "hello"))

When run from the command line, this program will report a contract 
violation,
correctly indicating the problem:

    $ racket c.rkt 
    foo: contract violation
      expected: integer?
      given: "hello"
      in: the 1st argument of
          (-> integer? any/c)
      contract from: (function foo)
      blaming: e:\Alex\t\c.rkt
       (assuming the contract is correct)
      at: e:\Alex\t\c.rkt:4.18

If I compile and make a distribution from this program using `raco exe`
followed by `raco dist`, than try to run the resulting executable I get:

    $ raco exe c.rkt
    $ raco dist c-dist c.exe
    $ ./c-dist/c.exe
    build-path: contract violation
      expected: (or/c path-for-some-system? path-string? 'up 'same)
      given: #f
      argument position: 1st
      other arguments...:
       "pkgs"

Is there a way to improve this error message?  I sort of understand why the
program not be able to report the full contract and line number, but it 
should
at least say something along the lines of "a contract violation has 
occurred,
no further detail available", instead of reporting the `build-path` contract
violation.

Thanks,
Alex.

-- 
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