design: nested when silently drops outer condition — should error or document as unsupported #23
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
when condA $ when condB $ ...silently discardscondA. The innersetConditionoverwritesssConditionwithcondBand returns without any indication that the outer condition was lost:The doc comment in
DSL.hssays "applyingwhenagain replaces it" — but that refers to sequential calls in ado-block, not nesting. Nested calls look semantically like "gate by condA AND condB", which is not what happens.Example
The resulting profile has condition
processRunning "steam"only.cpuLoad 0.8is gone.Options
setConditionreceives aProfileBuilder (); it could return a restricted type (e.g.BodyBuilder) that does not exposesetCondition, so nesting is rejected at compile time.ssCondition /= Nothingbefore overwriting and returnLeftwith a newNestedConditionerror.And— replace instead of erroring, but combine:ssCondition = Just (And existing new).whenso future refactors do not accidentally change the semantics.whenin a profile silently re-scopes earlier actions under the new condition #30