It's worth the trouble in some situations.  Generally I only use it
when the parameters are referred to exactly once, or when I know that
the arguments are always simple expressions without side effects.

There is code in the compiler to optimize expressions of the form
((lambda (x) ...) y), but as I recall it's slightly buggy, so I don't
trust a simple integrate-operator declaration to do the right thing.

Sometimes there are situations that integrate-operator would expand into

    ((lambda (x) ... x ... x ...) (car y))

In many cases it's beneficial to optimize this into

    ... (car y) ... (car y) ...

but the compiler won't do that, while define-integrable will.

Some basic discussion in case you haven't seen it:

    
http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/In_002dline-Coding.html#In_002dline-Coding

On Sat, Sep 19, 2009 at 2:54 PM, Taylor R Campbell <campb...@mumble.net> wrote:
>   Date: Sat, 12 Sep 2009 09:46:16 -0700
>   From: Joe Marshall <jmarsh...@alum.mit.edu>
>
>   I did integrate-operator because the argument `object' is duplicated.
>   The slightly better job is offset by the potential for bugs later on.
>
> I didn't realize until you said this that DEFINE -> DEFINE-INTEGRABLE
> changed the semantics of programs.  Is this worth the trouble?  For
> those cases when it doesn't change semantics, does it actually improve
> the code that the compiler generates?
>


_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to