Goal
Try to remove R's [[ indexing form from normal IR code.
This is not an objection to bracket-heavy syntax. Brackets are fast and useful for data analysis. The problem is making the programmer choose between [ and [[ for closely related indexing/extraction operations when a simpler rule may suffice.
Desired ordinary notation includes forms such as:
x[3]
x[3:5]
x[mask]
matrix[i, j]
e$frog
Questions to settle:
- Can scalar
x[i] simply extract the indexed element, while ranges/masks naturally produce collections?
- Is there any important R
[[ behavior that cannot be expressed cleanly through ordinary [], $, or an explicitly named uncommon operation?
- What happens for lists, data frames, arrays, environments, recursive indexing, missing names, and replacement operations?
- What compatibility lowering is needed for imported R code that uses
[[?
The burden of proof should be on retaining [[. If it represents a genuinely necessary semantic distinction, document that distinction with examples. Otherwise compile it away during R-to-IR translation and keep it out of the normal IR surface language.
Goal
Try to remove R's
[[indexing form from normal IR code.This is not an objection to bracket-heavy syntax. Brackets are fast and useful for data analysis. The problem is making the programmer choose between
[and[[for closely related indexing/extraction operations when a simpler rule may suffice.Desired ordinary notation includes forms such as:
Questions to settle:
x[i]simply extract the indexed element, while ranges/masks naturally produce collections?[[behavior that cannot be expressed cleanly through ordinary[],$, or an explicitly named uncommon operation?[[?The burden of proof should be on retaining
[[. If it represents a genuinely necessary semantic distinction, document that distinction with examples. Otherwise compile it away during R-to-IR translation and keep it out of the normal IR surface language.