At Thu, 8 May 2014 20:40:35 +0200, Laurent wrote: > At the end of Matthew's (awesome and quite informative) "metaprogramming" > video [1] he uses a doc-string+contract `define`. > > Is the "doc-define.rkt" file available somewhere? Google only led me to the > corresponding paper [2] but I could not find the file in the archives.
The complete implementation is below. As you can see, it's just enough to make the talk's example run. > Also, I'm wondering why he chose not to show the usual in-source > documentation of Racket and instead went for something that is not built in > Racket as of today. The current in-source documentation tool is an experiment to figure out what we want and how it can work. I think the "doc-define.rkt" sketch better illustrates what we've figured out that we want --- not all in place, yet, but within reach --- and so it makes more sense in a talk. ---------------------------------------- #lang racket/base (require (for-syntax racket/base) scribble/srcdoc) (provide (rename-out [new-define define]) (all-from-out scribble/srcdoc)) (define-syntax (new-define stx) (syntax-case stx () [(_ (id arg ...) #:contract ctc #:doc doc body ...) #'(begin (provide (proc-doc/names id ctc (arg ...) doc)) (define (id arg ...) body ...))])) ____________________ Racket Users list: http://lists.racket-lang.org/users