Hi Joachim,
interesting approach. Unfortunately it won't work here, since the additional argument has to be the first. But I keep it in mind for another use case. Ciao, Steffen Joachim Tuchel schrieb am Samstag, 8. April 2023 10:42:08 (+02:00): Steffen, if you fear performance bottlenecks, did you consider using a Stream as a single block parameter? Your requirement sounds a bit as if you do some diving into a structure (recursion?) where "someone" (maybe even conditionally) adds another argument before the block is evaluated. I've had good results in both performance and readability with Streams in such scenarios... Just an idea, maybe completely useless... Joachim Am 07.04.23 um 19:18 schrieb Noury Bouraqadi: 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 -- ----------------------------------------------------------------------- Objektfabrik Joachim Tuchel mailto:jtuc...@objektfabrik.de Fliederweg 1 http://www.objektfabrik.de D-71640 Ludwigsburg http://joachimtuchel.wordpress.com Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1 -- Gesendet mit Vivaldi Mail. Laden Sie Vivaldi kostenlos von vivaldi.com herunter.