I've always considered "all objects respond to #value" as a bug.
It certainly is not portable: it wasn't in Smalltalk-80, or Apple Smalltalk,
or ANSI Smalltalk, and it isn't in GNU Smalltalk or Dolphin Smalltalk or
VisualWorks.  It's a peculiarity of Squeak/Pharo and Smalltalk/X.
This is a misfeature that can hide bugs until they are ready to hurt you.

On Mon, 6 Jan 2020 at 12:13, Santiago Dandois <santid...@gmail.com> wrote:
>
> It's better (conceptually and in performance) to use the inner block, but is 
> not always necessary. The #or: message sends the `value` message to it's 
> collaborator if the bolean is false. Blocks responds to value executing 
> theirs code, but all objects respond to value since it's defined in the 
> Object class as ^self. Therefore, the result is the same but the messages 
> involved and the order in which they are being sent are not. In performance, 
> for the case where the first bolean was true, is better the one with the 
> surrounding block , since the code inside it is never being executed.
>
> You should really try both versions with the debugger to see it by yourself.
>
> Cheers,
> Santiago Dandois
>
> El dom., 5 ene. 2020 a las 19:53, xap (<x...@router.33mail.com>) escribió:
>>
>> thx Rixhard. looks like or: takes an 'alternativeBlock', i.e. a block.
>> however substituting a parenthesized expression (or what i assume is one) as
>> I did before, in place of the inner block, w/ no other changes has the
>> method continue to work as expected, hence my question. *shrug* i need to
>> rtfm :-/
>>
>>
>>
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>

Reply via email to