Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could an second variation on the operator be created so it doesn't with %<-% from future #53

Open
UnclAlDeveloper opened this issue Apr 14, 2020 · 6 comments

Comments

@UnclAlDeveloper
Copy link

Since %<-% is also used by future and the usage of namespaces with operators is a little messy zeallot::%<-%(c(a, b), c(1, 2)) to differentiate between the different overrides of the operator, could a second alternative variation be created. It's a really useful operator, adding one of the pieces of functionality that r misses vs python. For my own use I've cloned and changed the operator to %<-c%, but I guess anything would work.

@nteetor
Copy link
Member

nteetor commented Apr 18, 2020

I'm not particularly familiar with the {future} package, is the %<-% operator required for certain {future} functionality?

@UnclAlDeveloper
Copy link
Author

Yes. Very much.

I don’t think future is part of tidyverse, but it is certainly part of the direction R is going in, and is already something of a mainstay. Multiple assignment (via zeallot) is something that R definitely lacks, but multiprocessing, which the future package addresses, is considered more important. I’d really recommend changing the %<-% operator to a similar variation, since anyone or any package that uses future will have to avoid any dependency on zeallot.

@UnclAlDeveloper
Copy link
Author

UnclAlDeveloper commented Apr 19, 2020

I’m assuming nteetor is the developer. If not, this is meant for the developer.

I asked in the OP if a second variant of %<-% could be created, but this would still allow override issues with the future library. Better would be to make it a unique operator. I use %<-c%. Whatever the developer prefers, but I’d really suggest making it unique (not %<-%) so that zeallot can become more mainstream.

@nteetor
Copy link
Member

nteetor commented Apr 20, 2020

I can appreciate the frustrations of namespace clash. Reading over the "Implicit of Explicit Futures" section found here, https://cran.r-project.org/web/packages/future/vignettes/future-1-overview.html, I see there is an alternative method for {future} that does not require %<-%.

Given that others have requested different changes to the zeallot operator for various reasons, see #29 and #50, I am hesitant to introduce a new operator. This is a slippery slope and I won't be able to make everyone happy.

See HenrikBengtsson/future#207 for the {future}'s author's take on the situation. Unfortunately, {zeallot} was developed and released in the aforementioned %<=% testing phase of {future}. So, at the time, there was no conflict. Since then {future} moved back to %<-%.

That issue also does a good job highlighting why a change to the operator is a poor idea. As I've said before (see #50), I wish multiple assignment were baked into R by default. In the meantime, the %<-% operator is as close to a plain ol' <- as I can get. Hopefully one day we'll all have concise multiple assignment code out of the box.

@chuckleong21
Copy link

Would it be a good idea to suggest the R Core Team add zeallot's functionality into the <- itself? Not sure how this is achievable in Internal C though.

@UnclAlDeveloper
Copy link
Author

I’d second that. I don’t use python much, but the ability to return / update multiple variables at once From a function call is one of the features that impressed me about it.

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

No branches or pull requests

3 participants