8. Missing inputs taken from the caller

When energy_required is left out, n_balance() looks for an object with that name in whatever code called it (R/nitrogen_balance.R:36); ghg_emission() does the same for feed_basket_quality. If another scenario's object is lying around under that name, the function uses it without saying anything. iCLEANED relies on this lookup, so the fix warns for now instead of stopping.

Version n_balance() without energy_required
Current (no message; used the caller's object)
Fixed n_balance(): energy_required was not supplied and was taken from the calling environment. Pass it explicitly; this lookup will be removed.
Reproduce this Open in Colab (R runtime; section 8)
Rscript reproduce_critical_issues.R 8 using reproduce_critical_issues.R (installs what it needs into its own library and cleaned @ 800d53a). Add CLEANED_FIXES=proposed_fixes.R with proposed_fixes.R for the fixed column.
Test: test-critical-08-dynamic-scoping.R · Proposed change: F08.diff · Open an issue in CIAT/cleaned

Comments

Comments are GitHub Discussions on peetmate/cleaned-review; sign in with GitHub to post.