[pro] The Best Examples of "Code is Data"

Daniel Weinreb dlw at itasoftware.com
Thu Sep 9 14:42:15 UTC 2010



Luís Oliveira wrote:
> On Tue, Sep 7, 2010 at 11:15 PM, Daniel Weinreb <dlw at itasoftware.com> wrote:
>   
>> What happens if you do
>>
>> (defun foo (x)
>>   (plus x 3))
>>     
>
>   

Have you tried it?  CCL gets very unhappy!

> Since (constantp 'x) yields nil, the compiler macro will bail out.
Yeah, you'd think.

Maybe I made a mistake.
>  I
> suppose a smarter version could perform some optimizations when only
> one of the arguments is constant.
>
> On a related note, I just came across this SBCL effort
> <https://bugs.launchpad.net/sbcl/+bug/632368> which has the potential
> to make compiler macros significantly more powerful by handing forms
> over only after they've been through the compiler's inlining and
> constant propagation phases!
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20100909/f93b15d7/attachment.html>


More information about the pro mailing list