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

Purge <- usage when not strictly necessary #3590

Closed
MichaelChirico opened this issue May 24, 2019 · 3 comments · Fixed by #3592
Closed

Purge <- usage when not strictly necessary #3590

MichaelChirico opened this issue May 24, 2019 · 3 comments · Fixed by #3592

Comments

@MichaelChirico
Copy link
Member

Follow-up to comment here:

#3582 (comment)

Also added to Contributing

There's a decent amount of manual clean-up to do, unless someone has as better regex for catching the valid <- usages:

grep -r "<-" R | wc -l
628

I wonder how feasible it is to just blanket replace & then patch in the = that cause errors because <- is required 🤔

@jangorecki
Copy link
Member

jangorecki commented May 24, 2019

IMO this is not really that important stuff. I prefer to use =, but when I see <- around, then I align to style in the file that I am writing to. AFAIR our functions definitions uses <- quite consistently.
There is not really any harm (as opposed to what is being widely preached) to have both, assuming people who read data.table code know R. The harm might be only for newcomers to R language, to whom those preaches are probably targeted to. Can we close this one?

@MichaelChirico
Copy link
Member Author

MichaelChirico commented May 24, 2019

I don't really notice much myself, but the linked comment and this commit: 5024343

led me to file this in the spirit of consistency.

Added Low since it's extremely low on importance.

@mattdowle
Copy link
Member

mattdowle commented May 24, 2019

Like @jangorecki, I don't think I would have put effort into this either. But now Michael has, it's quite nice to get this out of the way; it's higher value than I thought. It should make PRs easier/faster, particularly as we see new contributors hopefully.
Using =, we don't need to worry about the danger of x<-3 when x < -3 was meant. And since assignment is a function in R which has a value (and -3 is coerced to TRUE silently), this error can go undetected. Using = we don't need to implement and maintain quality control checks to ensure spaces are around every operator. I wonder how many of the people who've been told to use <-, and are convinced <- is best because all the experts agree so it must be right, realize this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants