[Openmcl-devel] Quick HW question...

Spires, Shannon V svspire at sandia.gov
Wed Nov 17 10:14:10 PST 2010


On Nov 17, 2010, at 10:47 AM, Gary Byers <gb at clozure.com> wrote:

> Suppose that there were semi-magic macros (I -think- that they could be macros)
> called something like EXPECTED-TRUE and EXPECTED-FALSE that each took a single
> form and just caused that form to return whatever it returned, but the contract
> was that the compiler could treat them as advice about whether the primary
> return value was likely to be NIL or not.  So you could say:
> 
> (if (expected-false (some-test))
>   (exceptional-case)
>   (common-case))

How about 
(if (some-test)
	(exceptional-case)
	(locally (declare expected-branch)
		(common case)))

or, more portably but less semantically meaningful:

(if (some-test)
	(exceptional-case)
	(locally (declare (optimize (speed 3)))
		(common case)))

or -- easiest of all -- when speed=3, the compiler automatically codes the first clause in an if or a cond or a case to be the expected one.


-Shannon Spires





More information about the Openmcl-devel mailing list