{"id":"language--planned-loop-mutations","name":"Planned collection mutation","owner":"yeho","package":"language","kind":"language","signature":"plan remove expression\nplan removeAt index\nplan add value\nplan addAt index value","description":"plan remove, removeAt, add, and addAt describe mutations to apply around iteration without mutating the active traversal directly.","context":"For Kyber-ready code, collect intended changes separately and apply them after the loop.","parameters":[],"returns":"","members":[],"tags":["add","addAt","boundaries","cpu","language","plan","remove","removeAt","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"conformance-2026.1.json: planned-loop-mutations; parser_statements.cpp"},"status":"generated-cpp-only","notes":["Planned loop mutation is generated-C++ only.","The explicit two-phase alternative is easy to inspect and portable across current targets."],"examples":[{"id":"0","title":"Complete program","description":"Queue a structural collection edit while reading the original iteration snapshot.","code":"list of int scores = [10, -1, 20]\nfor score at index in scores\n{\n    if score < 0 { plan remove score }\n}\nfor score in scores { Console.Log(Text.From(score)) }\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__planned_loop_mutations\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"03ae7baa1bb3ef81359bee108ccd9bad2c072f6dcfc095f60a47fa072457fe54","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null},{"id":"1","title":"Complete program","description":"Queue a structural collection edit while reading the original iteration snapshot.","code":"list of int scores = [10, -1, 20]\nfor score at index in scores\n{\n    if score < 0 { plan removeAt index }\n}\nfor score in scores { Console.Log(Text.From(score)) }\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__planned_loop_mutations\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"9d26d122bf6b924028f9fe5c77ad9d95f92dcc4c775f30c30cdef76468306a37","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null},{"id":"2","title":"Complete program","description":"Queue a structural collection edit while reading the original iteration snapshot.","code":"list of int scores = [10, -1, 20]\nfor score at index in scores\n{\n    if score < 0 { plan add 5 }\n}\nfor score in scores { Console.Log(Text.From(score)) }\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__planned_loop_mutations\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"c6bdf220e99145efc138a5daa68136e7e59f07115e788cde5210a6a82635cc4c","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null},{"id":"3","title":"Complete program","description":"Queue a structural collection edit while reading the original iteration snapshot.","code":"list of int scores = [10, -1, 20]\nfor score at index in scores\n{\n    if score < 0 { plan addAt index 5 }\n}\nfor score in scores { Console.Log(Text.From(score)) }\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__planned_loop_mutations\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"93162cae149e292da39c8ad7c510d988660d2ecb90882c25398aa7d524e4d588","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=language--planned-loop-mutations","json":"https://demonhunterlabs.com/reference/items/language--planned-loop-mutations.json","markdown":"https://demonhunterlabs.com/reference/text/language--planned-loop-mutations.md"}
