13.7: Chapter Conclusion

Deep into Pharo · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    Read aloud

    How

    Speed: 1×
    Light up
    Highlight

    Symbols: Mulberry Symbols, © 2018–2026 Steve Lee, CC BY-SA 4.0 (licence, the set), the site's own copies.

    From LibreTexts, under CC BY-SA 3.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    13.7: Chapter Conclusion

    In this chapter we learned how to use blocks, also called lexical closures, and how they are implemented. We saw that we can use a block even if the method defining it has returned. A block can access its own variables and also non local variables: instance variables, temporaries and arguments of the defining method. We also saw how blocks can terminate a method and return a value to the sender. We say that these blocks are non-local returning blocks and that some care has to be taken to avoid errors: a block can not terminate a method that has already returned. Finally, we show what contexts are and how they play an important role with block creation and execution. We show what the thisContext pseudo variable is and how to use it to get information about the executing context and potentially change it.

    We thank Eliot Miranda for the clarifications.


    This page titled 13.7: Chapter Conclusion was last modified on Mon, 26 Jul 2021 15:16:42 GMT and is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform.