[racket] macros that expand to "provide/contract"

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Thu Sep 15 21:23:48 EDT 2011

If I have a syntax extension that expands to include "define" and/or 
"provide/contract" (at top level, possibly within a "begin"), will that 
break any Racket tools?

The "myprogram.rkt" below works, but I don't know whether this will 
break some tool now or in the future.

#lang racket/base
;; File: foo.rkt
(require racket/contract)
(define-syntax foo-define/provide/contract/begin
  (syntax-rules ()
    ((_ SYM CONTRACT BODY0 BODYn ...)
     (begin (display "*DEBUG* before\n")
            (define SYM BODY0 BODYn ...)
            (provide/contract (SYM CONTRACT))
            (display "*DEBUG* after\n")))))
(provide foo-define/provide/contract/begin)

#lang racket/base
;; File: mymodule.rkt
(require "foo.rkt")
(foo-define/provide/contract/begin onetwothree number? 123)

#lang racket/base
;; File: myprogram.rkt
(require "mymodule.rkt")
(printf "onetwothree is ~S\n" onetwothree)

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.