Can compiler macros make use of type declarations?
Chaitanya Gupta
mail at chaitanyagupta.com
Tue Nov 7 03:23:35 UTC 2017
On 7 November 2017 at 02:54, Steve Losh <steve at stevelosh.com> wrote:
> Check out Bike's compiler-macro library, specifically the `form-type`
> function: https://github.com/Bike/compiler-macro
This is exactly what I was looking for. Thanks a ton!
Chaitanya
>
> On Mon, Nov 6, 2017 at 3:43 PM, Chaitanya Gupta <mail at chaitanyagupta.com> wrote:
>> Let's say I have created a function called `FOO`:
>>
>> (defun foo (x)
>> ...)
>>
>> To optimize this function, I write a compiler macro. Can I make use of
>> type declarations that users of `FOO` might have made for the argument
>> `X` that is passed in to it?
>>
>> That is, let's say `FOO` is used like this:
>>
>> (let ((a (something-that-returns-an-integer)))
>> (declare (integer a))
>> (foo a))
>>
>> The compiler macro for `FOO` cannot make any optimizations on the
>> value of `A`, but can it take advantage of the fact that `A` is
>> declared as in `INTEGER` here?
>>
>> Chaitanya
>>
>
More information about the pro
mailing list