[Newbies] [] whileTrue: [] implementation

Erlis Vidal erlis at erlisvidal.com
Tue Oct 4 17:16:37 UTC 2011


Thanks Bert!

The byte code has the answer, I thought that the byte code will map the
source code but I see that's not the case, probably to ensure some
optimizations.. or to do that "jump" I don't know how to do that in
smalltalk

Thanks a lot for taking the time to answer such a newbie question.

Erlis

On Tue, Oct 4, 2011 at 12:57 PM, Bert Freudenberg <bert at freudenbergs.de>wrote:

> On 04.10.2011, at 18:41, Erlis Vidal wrote:
>
> Can I add methods to literal blocks?
>
>
> Yes.
>
> Where do I implement those methods?
>
>
> In class BlockClosure.
>
>
> In case your answer is in BlockClosures, why I don't see any ifTrue: in the
> while implementation?
>
>
> Because the compiler generates a jump byte code for whileTrue: directly. In
> a browser on the whileTrue: method, click the "source" button to switch to
> showing byte codes.
>
>  - Bert -
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20111004/043806b8/attachment.htm


More information about the Beginners mailing list