help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ProcessVariable>>valueIfAbsent: bug (and fix)


From: Piotr Klibert
Subject: ProcessVariable>>valueIfAbsent: bug (and fix)
Date: Tue, 08 Jun 2021 17:06:53 +0200
User-agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]