Re: [Pharo-users] Block evaluation with n+1 arguments

"[email protected]" <[email protected]> Mon, 10 Apr 2023 20:28:10 +0200
Newsgroups gmane.comp.lang.smalltalk.vwnc,gmane.comp.lang.smalltalk.pharo.user
Message-ID <[email protected]>
Tx :)

The new mooc will be good.

S

> On 10 Apr 2023, at 18:24, Richard Sargent <[email protected]> wrote:
> 
> Excellent write up, Stephane!
> 
> I will add that over the years, there have been many times (countless!) when developing/debugging involved a complex block and that turned out to be significant nuisance.
> I can elaborate on the details, but once a block gets passed around, revising it on the fly breaks debug and continue.
> 
> Having a block comprise a single message send allows one to revise that method as and when needed.
>  
>  
> From: [email protected] <[email protected]> On Behalf Of [email protected]
> Sent: April 10, 2023 07:03
> To: Any question about pharo is welcome <[email protected]>
> Cc: [email protected]
> Subject: Re: [vwnc] [Pharo-users] Block evaluation with n+1 arguments
>  
> BTW to me when a block needs too many arguments it feels like that an object has to be born :)
> With an object I can just sent or not a given extra argument. 
>  
> Now I do not know enough your specific context but what I learned is that complex blocks are difficult to follow, manipulate…
> so I keep block as simple as possible and else I create little objects.
>  
>  
> This is a little lectures from a super cool forthcoming mooc
>  
>                 https://urldefense.com/v3/__https://rmod-files.lille.inria.fr/DesignCoffeeClub/ForLearningLab/7-Lang-04-BlocksVsObjects.pdf__;!!DZ3fjg!6tWh60P8GNH6CoutL5ty4UXcST5BX9qE4X4p9L7YG4CgpKRJ2dZ_zmPgAvF8QfRagvI9gKV-olsvdYNl4cE58IOj9WYj2ieM2zI$  <https://urldefense.com/v3/__https:/rmod-files.lille.inria.fr/DesignCoffeeClub/ForLearningLab/7-Lang-04-BlocksVsObjects.pdf__;!!DZ3fjg!7bRnSLpPY1OiW_EoNtvSDBVMfYN5owvLQjTs_FdNbynPLMw7hmdZCNifkawlO9Hz-NbVkGnnh37u3XIaEJEAHjFBHHppJxSeBgY$>
>  
>  
> 
> 
>> On 6 Apr 2023, at 15:28, Steffen Märcker <[email protected] <mailto:[email protected]>> 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