Hi,
it seems to me that the dbc egg does not work well when using the
compiler switch "-debug-info".
Without -debug-info my test executable procuces the following output
(something like that I had expected):
----
Contract violation in (add):
...
Error: exception-handler returned
...
dbc-supplier-test.scm:10: signal <--
----
- but -
When compiled *with* "-debug-info", the executable produces no output at
all.
(Maybe the problem has something to do with an exception handler that
returns on a non-continuable exception? - I tried a simple example -
but the simple example works (shows some output) with and without
"-debug-info")
The problem is very simple to reproduce - put the attached files in a
directory and call
> csc -sJ %dbc-supplier-test.scm
> csc -sJ dbc-supplier-test.scm
> csc dbc-client-test.scm
> ./dbc-client-test
=> expected output
> csc -debug-info dbc-client-test.scm
> ./dbc-client-test
=> no output
I tried different things
- also compiling the ...import.scm-files
- compiling *all* files with "-debug-info"
- removing the *.scm files before compiling the final executable
but nothing works (if "-debug-info" is used)
(By the way - I also don't understand why I need the "(use extras)" in
"dbc-client-test.scm" - but without that the executable complains
"Error: unbound variable: sort")
Martin
Attachments
- output.std-out.txt / output.std-err.txt
full output of the executable
- %dbc-supplier-test.scm
raw definition of "add"
- dbc-supplier-test.scm
contract definition for "add"
- dbc-client-test.scm
the "executable" that uses "add"
(module dbc-client-test ()
(import scheme chicken)
(use extras)
(use dbc-supplier-test)
(print (add "a" "b"))
)
(module %dbc-supplier-test (add)
(import scheme chicken)
(define add (lambda (a b)
(+ a b)
))
)
(module dbc-supplier-test (add)
(import scheme chicken)
(use dbc)
(use (prefix %dbc-supplier-test %))
(contract-check-level 2)
(init-dbc)
(define-with-contract add
(contract (result)
((_ a b) (and (number? a) (number? b)) (number? result))
)
%add
)
(exit-dbc-with dbc-supplier-test)
)
Error: exception-handler returned
Call history:
dbc-supplier-test.scm:10: g373
dbc-supplier-test.scm:10: open-output-string
dbc-supplier-test.scm:10: ##sys#check-output-port
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#print
dbc-supplier-test.scm:10: ##sys#write-char-0
dbc-supplier-test.scm:10: get-output-string
dbc-supplier-test.scm:10: error
dbc-supplier-test.scm:10: k307
dbc-supplier-test.scm:10: g311
dbc-supplier-test.scm:10: dbc#make-contract-condition
dbc-supplier-test.scm:10: signal <--
Contract violation in (add):
(add a b)
didn't match any pattern
((_ a b))
or precondition
((and (number? a) (number? b)))
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users