emacs-devel
[Top][All Lists]
Advanced

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

Re: User-reserved element in byte code vectors


From: Miles Bader
Subject: Re: User-reserved element in byte code vectors
Date: Tue, 18 May 2004 19:45:46 -0400
User-agent: Mutt/1.3.28i

On Tue, May 18, 2004 at 09:17:44AM -0400, Stefan Monnier wrote:
> Not even necessary.  We can easily do
> 
>   (defmacro rcurry (f &rest args)
>     `(curry rcurry-helper f ,@args))
> 
> and make a rcurry-helper subroutine.  And for Richard's permutation of
> args, we can also do it that way with curry-reorg auxiliary function.

Hmmm, I think I'm convinced.

There is one little wrinkle though -- by the time something like
`rcurry-helper' gets called, some information has been lost: which args are
from the funvec, and which are user args.

So I think you'd have to explicitly include the dividing point, e.g.:

   (defmacro rcurry (f &rest args)
     `(curry rcurry-helper (length args) f ,@args))

Still, since presumably such cases will be much rarer than typical curry uses
(e.g., closures), I agree that it seems better to pay the small extra cost
there, rather than adding it to every curry.

Since you've got to include the extra slot anyway, you could make it
something more general, e.g., called it `permuted-funcall' instead of
`rcurry-helper', and allow wackiness to ensue. :-)  In either case, it could
be useful for direct use by programmers too, e.g., to cheaply convert from
one argument convention to another, you could make a curry-object that omits
the arguments, but still specifies the `permutation recipe'.

> I think paying one extra word for each and every closure ever created from
> now on, just because of the remote possibility that someone will want
> something like rcurry and will want it to be really efficient and that
> someone will not prefer some other implementation....

Well, OK, I'm now on your side, but it's still Richard's call.

Richard, if you don't care very much though, I'll just take out the reserved
slot; I agree with Stefan that there's ample room for expansion without it,
and that it's better to add a slight extra expense to exceptional cases
rather than to every curry object.

-Miles
-- 
((lambda (x) (list x x)) (lambda (x) (list x x)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]