Skip to content

Dots in function names

4 messages · Mike Prager, Thomas Lumley, Peter Dalgaard

#
Recent R function names seem to be using CaseOfTheLetters to mark words 
rather than dots as was done previously.  Is the use of dots in function 
names deprecated, or is that simply a style choice?  Will function names 
with dots cause problems in future revisions?

Mike Prager
#
On Fri, 30 Sep 2005, Mike Prager wrote:

            
There are, and always have been, problems with using dots because of the 
way S3 methods work.  These are getting worse as more functions become 
generic but are getting better as more methods are in namespaces and thus 
registered.

I don't expect dots to go away any time soon, so the choice between 
name.with.dots(), name_with_underscores(), runonname(), and 
nameCamelCased() is really a stylistic one.

 	-thomas
#
"Mike Prager" <Mike.Prager at noaa.gov> writes:
Well, come the S4 revolution and dots will cause trouble no more...

The main reason dots have fallen from grace is that they cause
ambiguity in relation to S3 methods. In a nutshell: t.test is not a
transpose method for objects of class "test". Since we check S3
methods automatically,  it is problematic to keep track of things that
look like S3 methods without being so. Check out
.make_S3_methods_stop_list() (in the tools package).
#
on 9/30/2005 2:55 PM Peter Dalgaard said the following:
My thanks to Thomas Lumley and Peter Dalgaard for their replies.  Being 
skeptical about software revolutions, I infer that dots will be of some 
concern for a long time.

At the same time, I expect that having names with underscores would 
limit compatibility with S-PLUS. 

As a user, I have not encountered problems with dots, and I don't 
understand whether the concern is likely to apply at the user level.  (I 
was unable to locate the function that P.D. mentioned above.)  Sorry if 
this seems dense, but I am not particularly conversant with the 
internals of R nor experienced in object-oriented programming.

So while I understand Peter's example showing that dots can be 
ambiguous, I am still at a loss as to whether that is of real practical 
concern at a user level; for example, in writing functions that will 
have limited distribution, or for functions that eventually may be 
incorporated into an R package.  I am guessing not, but will appreciate 
more comments if I have that wrong....

Mike Prager