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

Dot names #20

Open
jonocarroll opened this issue Aug 5, 2016 · 2 comments
Open

Dot names #20

jonocarroll opened this issue Aug 5, 2016 · 2 comments

Comments

@jonocarroll
Copy link

Dots in identifier names are just part of the identifier. They are not scope operators. They are not operators at all. They are just a legal character to use in the names of things. They are often used where a normal human being would use underscores, since underscores were assignment operators in S, which I promise you don’t even want to think about.

I'm not sure if you're still updating, or what your understanding is at this point, but this bit is slightly off. Dots are used in function names for method overloading (by class), so print(x) dispatches differently depending on the class of x.

For example, print(data.frame(x)) actually calls print.data.frame(x), but you may want to call print.default() explicitly.

@tdsmith
Copy link
Owner

tdsmith commented Aug 26, 2016

It's still true that they are not any sort of operator; the method overloading code just understands certain magical names that happen to use . as a separator and dispatches to them at runtime.

I should really add a section on the different class systems!

@dwinsemius
Copy link

Also a leading dot in a name will make it "special" in some sense, e.g., ls will not return its name unless 'all.names' is set to TRUE. Also isolated dots have been taken over as meaningful in tidyverse syntax. Arguably this does require consideration of scope.

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