posit-dev / positron

Positron, a next-generation data science IDE
Other
2.24k stars 67 forks source link

Diagnostics: No symbol in scope when using future assignment construct #3047

Open juliasilge opened 3 months ago

juliasilge commented 3 months ago

Discussed in https://github.com/posit-dev/positron-beta/discussions/174

Originally posted by **jeffkeller-einc** May 7, 2024 Positron complains about a missing symbol when using the {future} assignment construct `%<-%` even after calling `library(future)` and setting a `plan`. Screenshot 2024-05-07 at 9 57 09 AM
juliasilge commented 3 months ago

The future package has a special assignment operator %<-%: https://future.futureverse.org/reference/future.html

I just tested this out, and it turns out you can do it with right assignment too! 😵

library(future)
x <- rnorm(1000)
{ median(x) } %globals% list(x = x, median = stats::median) %->% y 

I am not sure how we might want to handle this kind of thing, given the vast constellation of operators that packages can contribute.

DavisVaughan commented 3 months ago

Same issue in RStudio. This is a very hard problem to get right in the general case.

Screenshot 2024-05-07 at 3 15 02 PM
lionel- commented 3 months ago

Steps to fix: