[plt-scheme] Catch an unknown method error

From: Filipe Cabecinhas (filcab at gmail.com)
Date: Sat Feb 23 07:28:42 EST 2008

So, I was trying to mix Ryan and Noel's versions (so I wouldn't have  
to use the exception mechanism and I got a better error message (it's  
weird when you use send but have an error message about send/apply))  
but I got this error:

compile: bad syntax; function application is not allowed, because no # 
%app syntax transformer is bound in: (syntax-case stx () ...

I found this website about the error but I can't see where I may have  
the same bug as him.

The code:

(module send scheme/base
   (require (rename-in scheme/class [send o:send]))
   (provide send)

   ;; From Ryan Culpepper and Noel Welsh's macros
   (define-syntax (send stx)
     (syntax-case stx ()
       [(_ obj name arg ...)
        ;; Make the temporary names we'll bind values to
            ([obj-name       (datum->syntax stx (gensym))]
             [(arg-name ...) (datum->syntax
                              (map gensym (syntax->datum (syntax  
(arg ...)))))]
             [args-length    (datum->syntax
                              (length (syntax->datum (syntax  
(arg ...)))))])
          ;; Bind the arguments to names, so we only evaluate once
           (let ([obj-name obj]
                 [arg-name arg]
             (if (and (not (method-in-interface? 'name (object- 
interface obj-name)))
                      (object-method-arity-includes? obj-name 'forward- 
                                                     (add1 args- 
                 (o:send obj-name forward-invocation 'name arg-name ...)
                 (o:send obj-name name arg-name ...)))))])))

Also. where Can I find more information about the "phase level" and  
macros in Scheme? I didn't really get it when I read the reference.  
Maybe v372's docs are better atm?


Posted on the users mailing list.