Problem
IR currently reserves bare fn as a function-constructor spelling. The IR README already notes the consequence: old R code using fn as a variable or argument must be changed.
That is a package-ecosystem compatibility break, not just a cosmetic source change. rlang uses fn in live source code; for example R/trace.R contains a formal named fn (call_trace_context <- function(call, fn)) and assigns to fn inside the function. rlang is foundational for testthat, tibble, dplyr, and the tidyverse.
This matters immediately for translating r-koans into IR: the lessons can be rewritten, but the standard teaching/testing stack should not have to be forked merely to get past the parser.
Preferred invariant
Unmodified R packages should continue to parse and load under IR unless IR intentionally changes their semantics. New IR syntax should be additive where possible.
The smallest compatibility-preserving option appears to be to stop reserving ASCII fn and keep λ / ƒ as the distinctive function-constructor spellings. A more contextual parser is also possible, but the acceptance criterion should be package compatibility rather than a particular implementation.
Add a package smoke gate
Build IR, then install/load unmodified current releases of at least:
rlang
testthat
tibble
dplyr
Optionally add the tidyverse meta-package once the smaller gate is reliable.
Then run an upstream testthat test containing IR syntax, for example:
library(testthat)
test_that("IR spellings work inside upstream testthat", {
answer ← 8 ÷ 2
expect_true(answer ≟ 4)
})
Also parse a representative dependency source file that contains a bare fn identifier so this exact regression cannot come back silently.
Why not rewrite testthat first?
Keep upstream testthat unchanged as a compatibility oracle. If we immediately translate/fork the test framework itself, the tests can accidentally hide a language-compatibility defect. IR-native test code can sit on top of upstream testthat once the package stack loads cleanly.
Acceptance criteria
Related motivation: translating isomorphisms/r-koans into IR.
Problem
IR currently reserves bare
fnas a function-constructor spelling. The IR README already notes the consequence: old R code usingfnas a variable or argument must be changed.That is a package-ecosystem compatibility break, not just a cosmetic source change.
rlangusesfnin live source code; for exampleR/trace.Rcontains a formal namedfn(call_trace_context <- function(call, fn)) and assigns tofninside the function.rlangis foundational fortestthat,tibble,dplyr, and the tidyverse.This matters immediately for translating
r-koansinto IR: the lessons can be rewritten, but the standard teaching/testing stack should not have to be forked merely to get past the parser.Preferred invariant
Unmodified R packages should continue to parse and load under IR unless IR intentionally changes their semantics. New IR syntax should be additive where possible.
The smallest compatibility-preserving option appears to be to stop reserving ASCII
fnand keepλ/ƒas the distinctive function-constructor spellings. A more contextual parser is also possible, but the acceptance criterion should be package compatibility rather than a particular implementation.Add a package smoke gate
Build IR, then install/load unmodified current releases of at least:
rlangtestthattibbledplyrOptionally add the
tidyversemeta-package once the smaller gate is reliable.Then run an upstream
testthattest containing IR syntax, for example:Also parse a representative dependency source file that contains a bare
fnidentifier so this exact regression cannot come back silently.Why not rewrite
testthatfirst?Keep upstream
testthatunchanged as a compatibility oracle. If we immediately translate/fork the test framework itself, the tests can accidentally hide a language-compatibility defect. IR-native test code can sit on top of upstreamtestthatonce the package stack loads cleanly.Acceptance criteria
rlanginstalls and loads under IRtestthatinstalls and loads under IRtibbleinstalls and loads under IRdplyrinstalls and loads under IRtestthattest written with←,÷, and≟passesfnfnremains reservedRelated motivation: translating
isomorphisms/r-koansinto IR.