Nikodemus Siivola <tsiivola@...> writes:
> I'm a bit curious here: can you tell something about use-cases?
> Since Python apparently can convince itself of the constantness of the
> stuff you're interested in, it seems to me that the compiler should be
> taking care of the constant-folding automagically. Is the constant-folding
> done by the compiler not aggressive enough, or is the something else at
I wanted to ask this question too, but I convinced myself that there
was at least one thing that an unmodified Python wasn't going to help
with, which was partial evaluation based on constant arguments; that
is, using only those facilities which ANSI gives for compiler
optimization of user code (compiler macros and constantp) doesn't let
you do the equivalent of SBCL's DEFOPTIMIZER and DEFTRANSFORM.
James -- I wonder if your problem goes away if you could hook into
those operators instead, because as Nikodemus says the compiler will
constant-fold away all the cases your constantp deals with -- it's
just that that happens _after_ user compiler macros have run.