[Newbies] Re: break out of do

Randal L. Schwartz merlyn at stonehenge.com
Fri Oct 3 16:27:13 UTC 2008


>>>>> "Nicolas" == Nicolas Cellier <ncellier at ifrance.com> writes:

Nicolas> For the fun of it, see also

Nicolas> http://article.gmane.org/gmane.comp.lang.smalltalk.gnu.general/3375/match=break

Oww.  I remember that.  It makes my head hurt.

You could even go further:

    Object >> valuedEscaper: aBlock
       ^ aBlock value: [ :finalValue | ^finalValue ]

    ...

    found := self valuedEscaper: [:escape |
           1 to: 10 do: [ :x |
               x = 3 ifTrue: [escape value: true].
           ]
    false].

Oh geez.  I think I just reinvented continuations. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list