Subject: bug#54802: OClosure: Make `interactive-form` a generic function

From: Stefan Monnier <[email-masked]>
Date: Fri, 15 Apr 2022 12:08:04 -0400

Po Lu [2022-04-15 12:27:02] wrote:
> Stefan Monnier <[email-masked]> writes:
>> I can do a sort of `oclosurep` from C already.  But that doesn't
>> guarantee that the OClosure has an interactive form, so in the case we
>> match `oclosurep` I'd still need to call another function from the ELisp
>> world (that's the one I called `generic-interactive-form` since it would
>> most naturally be a generic function)
> Well, as long as its possible, I think we should do that.

It's definitely possible.  The reason I resist doing that is that the
resulting API is ugly (you basically have two "identical" functions with
the only justification for the difference is that one is implemented in
C and the other is a generic function) and the only existing reason for
this ugliness is this one loop of yours whose behavior is brittle
anyway, whose first execution is 100x times slower (so the remaining 2x
slowdown when the loop is fast can't be that important), and whose
subsequent fast executions could trivially be made faster by caching the
result of the first call.

So, I'm waiting to hear what others have to say about this choice.

Eli and Lars, do you prefer the faster-but-uglier API or the
cleaner-but-slower API for `interactive-form`?

        Stefan