← Back to context Comment by tubs 12 hours ago Why create an array each time it iterates a Set rather than just iterating the Set? 3 comments tubs Reply willybrauner 12 hours ago I create a new copy of the Set because the functions called during the loop might modify it by removing elements via cleanup functions. Without a copy, iterating directly on the Set could cause unpredictable behavior. willybrauner 12 hours ago But as the article points out, this is a naive implementation. It could be discussed and greatly improved.
willybrauner 12 hours ago I create a new copy of the Set because the functions called during the loop might modify it by removing elements via cleanup functions. Without a copy, iterating directly on the Set could cause unpredictable behavior.
willybrauner 12 hours ago But as the article points out, this is a naive implementation. It could be discussed and greatly improved.
I create a new copy of the Set because the functions called during the loop might modify it by removing elements via cleanup functions. Without a copy, iterating directly on the Set could cause unpredictable behavior.
But as the article points out, this is a naive implementation. It could be discussed and greatly improved.