ProcessVariable>>valueIfAbsent: bug (and fix)

"Piotr Klibert" <[email protected]> Tue, 08 Jun 2021 17:06:53 +0200
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>
In the previous thread I mentioned a problem in ProcessVariable I encountered while trying out VisualGST. Turns out I was mistaken, the problem was triggered by something else, as I wasn't able to reproduce it after a fresh rebuild. Still, the bug is there for sure: the `valueIfAbsent` never evaluates the block it gets as an argument. Here's the patch:


    diff --git a/kernel/ProcEnv.st b/kernel/ProcEnv.st
    index d3780748..fa695641 100644
    --- a/kernel/ProcEnv.st
    +++ b/kernel/ProcEnv.st
    @@ -77,7 +77,7 @@ setting for the current process.'>
         valueIfAbsent: aBlock [
            "Return the value of this variable in the current process."
            <category: 'accessing'>
    -       ^Processor activeProcess environment at: self key ifAbsent: [ nil ]
    +       ^Processor activeProcess environment at: self key ifAbsent: aBlock.
         ]

         value [


(the method comment should probably also be changed a bit, now that I look at it...)


Best regard,
Piotr Klibert