On Wed, May 15, 2019 at 5:21 PM Tim Mackinnon <tim@testit.works> wrote:
>
> On a similar line - I’ve often noticed that an interesting block pattern in 
> Smalltalk which is overlooked in other languages is how we handle errors 
> through them.
>
> We often don’t throw exceptions but instead pass a useful block (and often 2) 
> for what to do instead.
>
> at:ifAbsent: comes to mind or at:ifPreset:ifAbsent: leading you to do 
> interesting things yourself like parseSource:onErrorRecoverWith: (or 
> whatever).
>
> I think this makes an interesting point about our block flexibility.

Although it is not exactly the same, the async style of programming
JavaScript uses similar approaches by passing "callback functions" as
arguments to certain functions. e.g. fopen('/path/to/file',
successFunction, errorHandler).

As said, it is not exactly the same thing, and 100% callback programs
can be a hell to work with, but the idiom of passing "lambdas" around
is similar.

Regards,

Esteban A. Maringolo

Reply via email to