Distinguish between procedure and macro

"Daniel Sadilek" <[email protected]> Fri, 23 Mar 2007 17:35:25 +0100
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Hello,

is it possible to find out if an identifier is bound to an ordinary
procedure or to a syntactic form?

My first guess was (type-of <identifier>) which raises an error if
called with an identifier of a syntactic form. I tried to distinguish
between procedure and syntactic form by catching that error:

(define-syntax syntactic-form?
  (syntax-rules ()
    ((_ identifier)
     (with/fc
      (lambda (error-record error-k)
        #t)
      (lambda ()
        (type-of identifier)
        #f)))))

But the error continuation doesn't get called.

I also tried inspecting the environment explicitly with (getprop
<identifier> (interaction-environment)). But it always returns a
procedure -- even when the identifier is bound to a syntactic form.

BTW: Is there anything like macroexpand in sisc?

Best regards
Daniel Sadilek

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV