[squeak-dev] #valueWithExit inconsistency (?)

Eliot Miranda eliot.miranda at gmail.com
Wed Feb 17 17:37:36 UTC 2021


On Wed, Feb 17, 2021 at 8:52 AM Marcel Taeumel <marcel.taeumel at hpi.de>
wrote:

> Hi Jaromir.
>
> I added commentary via Kernel-mt.1370. I don't think that the (outer
> block's) return value should ever be used in this construct. It is more
> like a #detect: but without meaningful return values.
>
> http://forum.world.st/explicit-return-from-a-block-tp51833.html
> http://forum.world.st/The-Trunk-Kernel-ul-519-mcz-td3077583.html
>
> I don't suppose it is idiomatic Smalltalk: "...but actually, I never had
> any reason to use this except when porting algorithms from Fortran or
> C... "
>

But there's a bug.  It should at least answer the result of value:. I'm
going to change it.

> Best,
> Marcel
>
> Am 16.02.2021 14:05:23 schrieb Jaromir <m at jaromir.net>:
> Current implementation of #valueWithExit seems a bit inconsistent in its
> return value: it returns either nil (if the receiver exited using the exit
> block) or the receiver.
>
> Would it be worth modifying it to always return nil? (there are no senders
> anyway)
>
> valueWithExit
> - self value: [ ^nil ]
> + ^self value: [ ^nil ]
>
> Or using a nice complementary method #valueWithExit:
>
> valueWithExit: aBlock
> self value: [^aBlock value].
> ^aBlock value
>
> valueWithExit
> ^self valueWithExit: [nil]
>
> Thanks
>
>
>
> -----
> Jaromir
> ^[^
> --
> Sent from: http://forum.world.st/Squeak-Dev-f45488.html
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210217/406f4221/attachment.html>


More information about the Squeak-dev mailing list