`box::export()` at namespace scope overrides export attribute declarations
- Dominant language
- R
- Stars
- 979
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
### Error description
## MWE
### `mwe.r`
```r
#' @export
test1 = 1
test2 = 2
box::export(test2)
```
```r
box::use(./mwe)
ls(mwe)
```
### Expected result
> ```
> [1] "test1" "test2"
> ```
### Actual result
> ```
> [1] "test2"
> ```
### Additional details
Calling `box::export()` in `.on_load()` works as expected; i.e. when changing `mwe.r` to the following, we get the expected result:
```r
#' @export
test1 = 1
test2 = 2
.on_load = function (ns) {
box::export(test2)
}
```
### R version
```plain text
_
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 3.1
year 2023
month 06
day 16
svn rev 84548
language R
version.string R version 4.3.1 (2023-06-16)
nickname Beagle Scouts
```
### ‘box’ version
1.1.3
Contributor guide
Research direction
Start by reproducing the MWE in mwe.r with the namespace-scope box::export(test2) call, then compare it with the .on_load() variant. Trace how the @export declaration and box::export() are processed, and add a regression test showing that both test1 and test2 remain exported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100