[Pharo-users] Re: BlockClosure folding

2022-03-15 Thread Hernán Morales Durand
This is an interesting pattern. Thank you for sharing. Hernán El mar, 15 mar 2022 a las 4:43, Julián Maestri () escribió: > Not satisfying the equality, but you can use polymorphism. > > Block >> , aBlock > ^ BlockCompositor andAll: OrderedCollection with: self with: aBlock > >

[Pharo-users] Re: BlockClosure folding

2022-03-15 Thread Hernán Morales Durand
Exactly. This was what I was looking for. Thank you Sean. Hernán El mar, 15 mar 2022 a las 19:15, escribió: > ComplexCondition as described in Andres Valloud, "A Mentoring Course on > Smalltalk" > > is available

[Pharo-users] Re: Null Object Pattern

2022-03-15 Thread Bernardo Ezequiel Contreras
if you are using the null object pattern then you should not write those checks (ifNil:ifNotNil:, isNil, isNotNil). you should send the message to an instance of the null object and that object should decide what to do. just an opinion. On Tue, Mar 15, 2022 at 3:16 PM wrote: > I had some

[Pharo-users] Re: Null Object Pattern

2022-03-15 Thread Todd Blanchard via Pharo-users
Why do you not just do something like [ “complicated code that might fail somewhere in here” ] on: Error do: [:error | nil] Use the on:do: exception handling to stay safe. Result := [anObject long chain of messages that might return a nilValue ] on: Error do: [:e |

[Pharo-users] Re: Null Object Pattern

2022-03-15 Thread Richard O'Keefe
I have a bad feeling about this. To start with, why do you CARE whether a particular method is inlined or not? However, I’m struggling a bit with the refactor due to inlining. Since #ifNil: variants might be inlined, it seems that something like: anObject with a long chain of messages ifNotNil:

[Pharo-users] Re: Null Object Pattern

2022-03-15 Thread Esteban Maringolo
+1 Inlining breaks the fundamental piece of OOP: Message sends. I'm sure there are use cases where inlining adds a significant speedup, but for some messages, I prefer them to be sent. Regards! Esteban A. Maringolo On Tue, Mar 15, 2022 at 3:16 PM wrote: > > I had some chaining that was

[Pharo-users] Null Object Pattern

2022-03-15 Thread sean
I had some chaining that was getting too complex due to many nil checks, so I started to refactor using a Null Object. However, I’m struggling a bit with the refactor due to inlining. Since #ifNil: variants might be inlined, it seems that something like: anObject with a long chain of

[Pharo-users] Re: BlockClosure folding

2022-03-15 Thread sean
ComplexCondition as described in [Andres Valloud, "A Mentoring Course on Smalltalk"](http://www.lulu.com/product/paperback/a-mentoring-course-on-smalltalk/3788890) is available at http://www.squeaksource.com/ComplexCondition.html With it, you can do something like: ``` ^[a includes: $.], [b