[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Procedural equivalence: the last debate

On Sun, Jun 2, 2013 at 10:56 PM, John Cowan <cowan@x> wrote:

It also occurs to me that with the introduction of records into the
language, it's possible for the user to get back procedures-with-identity
by wrapping the procedure in a trivial record, since records do have
identity in R6RS.  This enables all of Alex's use cases to come back,
at the expense of not being able to pass a procedure directly to a
HOF that wants to detect particular procedures and optimize them (the
fifth bullet).  There is no loss of power, but there is a considerable
loss of naturalness.

Yes, Scheme is pretty powerful, you can come up with workarounds
for most things.  You don't even need records, a pair or box works fine.

Of course, in the "easy" case all you have to do is rewrite all places
where the procedures are being created or used to box and unbox them.

In the hard case, the set of usages is open-ended and this is impossible,
e.g. you still can't memoize any HOFs.  Or it may be possible but highly
undesirable to perform the boxing, e.g. telling Emacs users that yes, they
can use hooks but first they have to wrap any procedure they want in a
global box and refer to that instead of the procedure itself.  All bets are
off if they want to redefine the procedure.

And in all cases it's quite likely the boxing overhead outweighs any potential
benefits of the optimization in the first place.

Scheme-reports mailing list