On Thursday, November 1, 2018 at 7:38:29 PM UTC+8, Alexander McLin wrote:
>
> I’m a little confused here, to me it looks like the second contract 
> violation is completely different from the first one. 
>

My program is only seven lines of code and does not call `build-path`.  
Also, if I fix the incorrect call to `foo` and rebuild the executable, the 
`build-path` contract violation is no longer reported and the program runs 
fine.  You might wan to actually build the executable and run it using the 
instructions I provided, to understand what I am trying to explain.

    #lang racket
    (require racket/contract)

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

    (module+ main
      (foo "hello"))

This is just a small example that illustrates the problem -- I have an 
actual application which is built into an executable and, whenever there is 
a contract violation error reported, regardless of what the contract 
violation is about, always the `build-path` contract violation shows up.  
At first, I was puzzled by this, but now, I have learned that when I see a 
build path contract error, I try to run the application in un-compiled mode 
(is there a better term?) and try to reproduce the issue -- but this is not 
always easy with complex applications.

Alex.


> You were expecting `foo` to raise a contract violation but in your 
> executable example it appears that contract violation is being raised by 
> the `build-path` function not `foo`. 
>
> Maybe it’s a entirely different error?

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