Skip to content

Remove r_syms.unbound - #1889

Merged
lionel- merged 3 commits into
mainfrom
feature/unbound-removal
Mar 31, 2026
Merged

lionel- merged 3 commits into
mainfrom
feature/unbound-removal

Conversation

@DavisVaughan

@DavisVaughan DavisVaughan commented Mar 30, 2026 •

Copy link
Copy Markdown
Member

Looks like we are going to lose R_UnboundValue as well, which I guess is reasonable on Luke's part

Detected in DavisVaughan/r-tree-sitter#44

I've inlined R_UnboundValue in place of r_syms.unbound in all the fallback paths and removed r_syms.unbound altogether since we can't use it now.

I'll call out one tricky case below

I am unsure if `r_null` is a valid return value from this helper, so I didn't want to use that. Instead we now set a `bool* found` flag on the way out.
Comment thread src/internal/eval-tidy.c
Comment on lines -242 to +254
return r_syms.unbound;
return r_null;
}
r_obj* ffi_data_pronoun_get(r_obj* pronoun, r_obj* sym, r_obj* error_call) {
if (r_typeof(pronoun) != R_TYPE_environment) {
r_abort("Internal error: Data pronoun must wrap an environment");
}

r_obj* obj = mask_find(pronoun, sym);
bool found;
r_obj* obj = mask_find(pronoun, sym, &found);

if (obj == r_syms.unbound) {
if (!found) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mask_find() was using r_syms.unbound as a return value here to mean "not found"

I considered using r_null as an alternative, but I feel like it may be possible for this function to return r_null as a valid value, so I went with a bool* found flag instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use something like quote(.__rlang_unbound__.) but the output flag sounds good to me too!

Comment thread src/internal/eval-tidy.c
Comment on lines -242 to +254
return r_syms.unbound;
return r_null;
}
r_obj* ffi_data_pronoun_get(r_obj* pronoun, r_obj* sym, r_obj* error_call) {
if (r_typeof(pronoun) != R_TYPE_environment) {
r_abort("Internal error: Data pronoun must wrap an environment");
}

r_obj* obj = mask_find(pronoun, sym);
bool found;
r_obj* obj = mask_find(pronoun, sym, &found);

if (obj == r_syms.unbound) {
if (!found) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use something like quote(.__rlang_unbound__.) but the output flag sounds good to me too!

@lionel-
lionel- merged commit 7837ec1 into main Mar 31, 2026
13 checks passed
@lionel-

lionel- commented Mar 31, 2026

Copy link
Copy Markdown
Member

Thanks!

@lionel-
lionel- deleted the feature/unbound-removal branch March 31, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants