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

Don't shim <- and { #12

Closed
krlmlr opened this issue Apr 26, 2021 · 9 comments · Fixed by #14
Closed

Don't shim <- and { #12

krlmlr opened this issue Apr 26, 2021 · 9 comments · Fixed by #14
Milestone

Comments

@krlmlr
Copy link
Collaborator

krlmlr commented Apr 26, 2021

to avoid repetition of output.

library(boomer)
library(tidyverse)

test <- boomer::rigger() + function() {
  a <- 1 + 2 * 3
}

test()
#> 2 * 3
#> [1] 6
#> 1 + 2 * 3
#> [1] 7
#> a <- 1 + 2 * 3
#> [1] 7
#> {
#>     a <- 1 + 2 * 3
#> }
#> [1] 7
#> [1] 7

Created on 2021-04-26 by the reprex package (v2.0.0)

@krlmlr krlmlr changed the title Don't boom <- and { Don't rig <- and { Apr 26, 2021
@krlmlr krlmlr changed the title Don't rig <- and { Don't shim <- and { Apr 26, 2021
This was referenced Apr 26, 2021
@moodymudskipper
Copy link
Owner

It would make sense most of the time, but in some corner cases it would prevent {boomer}, from spotting that one of these is overridden.

I think we can have an additional argument ignore defaulting to a vector of those you suggest + other assignment ops and parenthesis.

The doc would mention that :: and ::: are never boomed.

@krlmlr
Copy link
Collaborator Author

krlmlr commented Apr 26, 2021

Added to PR.

@moodymudskipper
Copy link
Owner

@krlmlr thanks, I've updated it to use options by default so the behavior of the addin can be easily modified too. And I've added "=" to the list of ignored functions.

1a11a91

@krlmlr
Copy link
Collaborator Author

krlmlr commented Apr 26, 2021

The "=" gives weird behavior on my end, I use ignore = c("~", "{", "(", "<-", "<<-") for now.

@moodymudskipper
Copy link
Owner

Do you have something reproducible ?

@krlmlr
Copy link
Collaborator Author

krlmlr commented Apr 26, 2021

Not yet. The error message mentioned names<- and .Primitive("<-"), I was happy to find the workaround 😅

@moodymudskipper moodymudskipper added this to the CRAN (0.1) milestone Jun 9, 2021
@moodymudskipper
Copy link
Owner

Since we've had quite a few changes since then and don't have anything reproducible, I'm closing for now

@krlmlr
Copy link
Collaborator Author

krlmlr commented Jun 11, 2021

Today:

library(boomer)
library(tidyverse)

test <- boomer::rigger() + function() {
  a <- 1 + 2 * 3
}

test()
#> 👇 e2
#> 💣 +
#> · 💣 *
#> · 💥 2 * 3
#> · [1] 6
#> · 
#> 💥 1 + 2 * 3
#> [1] 7
#> 
#> 👆 e2

Created on 2021-06-11 by the reprex package (v2.0.0)

I think it's fine, thanks for looking into it!

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants