CMUCL and SBCL have the Environment API somewhat available (*) You can see whether they store the inferred values in there.
Marco (*) Again, you can have a look at CLAST to see how to access it; I know: it is a shameless plug. > On Nov 9, 2017, at 09:18 , Chaitanya Gupta <m...@chaitanyagupta.com> wrote: > > So thanks to the replies on this I now know that most of the popular > Lisps do support inspecting the environment to figure out declared > types. > > But what about inferred types (e.g. in CMUCL, SBCL)? Do these Lisps > provide a way to know the inferred type of a variable if no > declaration was made explicitly? > > Chaitanya > > On 7 November 2017 at 02:13, Chaitanya Gupta <m...@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 > -- Marco Antoniotti, Associate Professor tel. +39 - 02 64 48 79 01 DISCo, Università Milano Bicocca U14 2043 http://bimib.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY Please check: http://troncopackage.org Please note that I am not checking my Spam-box anymore. Please do not forward this email without asking me first (cum grano salis).