(1) I have #value:valueWithArguments: in my personal library.
(2) The way to answer your question is to look at #valueWithArguments:,
    It normally goes through a primitive.
    However, it *does* have backup code that you could adapt.
(3) Without benchmarking, it's not clear whether the cost of not being
    able to go through the primitive will exceed the saving of not
    making another array.  It might not be the win you expect.
    Have you profile your code to find out whether this way of
    invoking a block is *worth* speeding up?
(4) aBlock value: {a} , remaining
    has the merit of working in other Smalltalks
    and the merit of being familiar to other programmers.
(5) Is there no way that you can restructure your code so that you
    no longer want to do this?  Point (1) is true, but only because
    I've never bothered to throw it away.  In the system where I
    wrote it, it *does* save time overall, but in the complete
    context, it wasn't worth doing.

On Fri, 7 Apr 2023 at 01:29, Steffen Märcker <merk...@web.de> wrote:

> Hi!
>
> I want to evaluate a block an argument 'arg1' and additional n arguments
> given in an array 'args'. The following code does the trick:
>
>     block valueWithArguments: (Array with: arg1) , args.
>
> Is there a way to do this without the overhead of creating a new Array?
> (How) Can I add additional #value:value:[...] methods to BlockClosure that
> evaluate the block with n arguments directly without falling back to
> #valueWithArguments: ? If yes, what's the maximum?
>
> Cheers!
> Steffen
>

Reply via email to