chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] numbers and compiler macros


From: Alex Shinn
Subject: Re: [Chicken-users] numbers and compiler macros
Date: Tue, 19 Jun 2007 22:03:09 +0900

On 6/18/07, felix winkelmann <address@hidden> wrote:

Should there be bugs, or if the code generated is too big, compiler macros
(which implement this feature) can be disabled via the
"-disable-compiler-macros"
option to chicken/csc.

Nice!  I've been wanting compiler macros for a while :)

Among other things, they can be used to implement
another feature I've wanted, first-class inlined procedures:

(define-compiler-macro (define-inline* params . body)
 (let ((body `(begin ,@body)))
   `(begin
      (define ,params ,body)
      (define-compiler-macro ,params
        `,,body))))

(define-inline* (foo x) ...)

This way FOO is inlined when applied directly, but is still
available as a normal procedure for first class usages
(e.g. with APPLY) and at runtime.

--
Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]