Steffen,

My first response, is do NOT optimize too early. The performance bottlenecks 
are not always where we think they are.

In Pharo you can add methods to BlockClosure class. You can go up to 255 
arguments IIRC.
But, of course there is no primitive to handle them, so you endup writing the 
same code.
Better use valueWithArguments:

block valueWithArguments: (multipleArgs copyWith: singleArg)
Noury
On Apr 6 2023, at 3:28 pm, 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