From cfe27a6d0ce3cd82750b17a5a942e5691a082209 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Thu, 26 Jan 2023 18:23:05 -0500 Subject: Fix with-all with new global ::matchId Fixes https://discord.com/channels/956758212152025098/1055633077323436103/1067636369263956028, I think Rename `On convergence` to `Before convergence`. Support fake lexical scope in `Before convergence`. --- virtual-programs/with-all.folk | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'virtual-programs') diff --git a/virtual-programs/with-all.folk b/virtual-programs/with-all.folk index e7bbec8f..5f5c3d65 100644 --- a/virtual-programs/with-all.folk +++ b/virtual-programs/with-all.folk @@ -10,21 +10,19 @@ When /someone/ wishes to collect matches for /clause/ { foreach varName $varNames { dict set match $varName [set $varName] } dict set ::collectedMatches $clause $match true - - On unmatch [subst { - dict unset ::collectedMatches {$clause} {$match} - }] + On unmatch { dict unset ::collectedMatches $clause $match } } When $::nodename has step count /c/ { - On convergence [format { - set clause {%s} - set __matchId %d - if {[dict exists $Statements::matches $__matchId] && + set matchId $::matchId + Before convergence { + if {[dict exists $Statements::matches $matchId] && [dict exists $::collectedMatches $clause]} { + set oldMatchId $::matchId; set ::matchId $matchId set matches [dict get $::collectedMatches $clause] Say the collected matches for $clause are [dict keys $matches] + set ::matchId $oldMatchId } - } $clause $::matchId] + } } On unmatch { dict unset ::collectedMatches $clause } } -- cgit v1.2.3