[racket] Compile-time vs. Runtime Calls to the Same Macro

From: Sina K. Heshmati (sina at khakbaz.com)
Date: Sat Feb 26 09:58:41 EST 2011

L.S.,

#lang racket
(require
 (for-syntax "check.rkt")
 "check.rkt")

(define-for-syntax a
  (qualify-member #'(public static a 0)))  ;; Phase 1 call FAILS

(define b
  (qualify-member #'(public static b 10))) ;; Phase 2 call does NOT FAIL

Any idea how I can make phase 1 calls to qualify-member not fail?

The file check.rkt that contains the qualify-member macro is pasted below. 
For other source files, please refer to:
https://github.com/sindoc/objective-racket/tree/master/src/objective-racket

Thank you in advance,
Sina

------------------------------------------- check.rkt
#lang racket

(require 
 (for-syntax "members.rkt")
 (for-syntax "utils.rkt")
 "members.rkt"
 "utils.rkt")

(provide qualify-member)

(define-syntax (qualify-member stx)
  (syntax-case stx ()
    ((qualify-member member)
     #`(with-handlers 
           ((exn:fail?
             (λ (exn)
               (show
                'unqualified-class-member 
                "Invalid class member \n ~a" exn))))
         (show member)
         (syntax-case member #,*member-keywords*
           #,@(map
               (λ (qualifier matcher)
                 #`((#, at matcher)
                    (#,qualifier member)))
               *member-qualifiers*
               *member-qualifier-matchers*))))))





Posted on the users mailing list.