racket/collects/honu/core/private/debug.rkt
2010-10-22 14:33:22 -06:00

18 lines
439 B
Racket

#lang scheme/base
(require (for-syntax scheme/base))
(provide debug)
(define-for-syntax verbose? #f)
(define-syntax (debug stx)
(if verbose?
(syntax-case stx ()
[(_ str x ...)
(with-syntax ([file (syntax-source #'str)]
[line (syntax-line #'str)]
[column (syntax-column #'str)])
#'(printf (string-append "~a at ~a:~a " str) file line column x ...))])
#'(void)))