[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ProcessVariable>>valueIfAbsent: bug (and fix)
From: |
Holger Freyther |
Subject: |
Re: ProcessVariable>>valueIfAbsent: bug (and fix) |
Date: |
Wed, 9 Jun 2021 16:18:47 +0800 |
Lovely find! Can you think of a testcase?
thank you!
holger
> On 8. Jun 2021, at 23:06, Piotr Klibert <piotrklibert@fastmail.com> wrote:
>
> 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
>