[squeak-dev] The Trunk: Kernel-mt.1371.mcz
Thiede, Christoph
Christoph.Thiede at student.hpi.uni-potsdam.de
Tue Mar 2 13:13:10 UTC 2021
Cool, nice utility - even though it does not support good readability of your code for sure :-) I have always used "thisContext return" for a similar result. :-D
What about supporting a return argument here as well, like:
self value: [ :ret | ^ ret ]
?
This could increase the usefulness of #valueWithExit, but on the other hand, all clients would need to send #cull: or #value:. Any opinions? :-)
Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Mittwoch, 17. Februar 2021 17:56:32
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: Kernel-mt.1371.mcz
Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1371.mcz
==================== Summary ====================
Name: Kernel-mt.1371
Author: mt
Time: 17 February 2021, 5:56:29.152426 pm
UUID: 1e5b05c3-feb7-e945-a253-3218ee358e74
Ancestors: Kernel-mt.1370
Extracts better examples for #valueWithExit from squeak-dev mailing list.
=============== Diff against Kernel-mt.1370 ===============
Item was changed:
----- Method: BlockClosure>>valueWithExit (in category 'evaluating') -----
valueWithExit
+ "Provides an exit block to the receiver. Use it to break out of the control flow with an early return. Examples below.
+ [:break | 1 to: 10 do: [:each | each > 5 ifTrue: [break value]]] valueWithExit.
+ 1 to: 10 do: [:each | [:continue | each > 5 ifTrue: [continue value]] valueWithExit]."
- "Provides an exit block to the receiver. Use it to break out of the control flow with an early return. For example:
- [:exit | 1 to: 10 do: [:each | each > 5 ifTrue: [exit value]]] valueWithExit"
self value: [ ^nil ]!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210302/42d59c2a/attachment.html>
More information about the Squeak-dev
mailing list
|