[Newbies] [] whileTrue: [] implementation

Erlis Vidal erlis at erlisvidal.com
Tue Oct 4 15:58:25 UTC 2011


Hi all,

I was looking at the implementation of some of the flow control methods and
I have a question with the method *whileTrue*.

First of all, I can see two identical implementation in the classes *
BlockClosure* and *BlockContext* the implementation is this

*whileTrue*: aBlock
    "Ordinarily compiled in-line, and therefore not overridable.
    This is in case the message is sent to other than a literal block.
    Evaluate the argument, aBlock, as long as the value of the receiver is
true."

    ^ [self value] whileTrue: [aBlock value]

I'm assuming here that there's another class *Block* I'm missing (something
like the literal block mentioned in the comment) which is the one that
contains the logic I was looking for. But I'm not able to find any other
whileTrue method in my image. What's the difference between BlockClosure and
BlockContext?

Thanks,
Erlis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20111004/ed43aeb9/attachment.htm


More information about the Beginners mailing list