[R] Dots in function names
Mike.Prager at noaa.gov
Fri Sep 30 21:29:46 CEST 2005
on 9/30/2005 2:55 PM Peter Dalgaard said the following:
>"Mike Prager" <Mike.Prager at noaa.gov> writes:
>>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?
>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).
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....
More information about the R-help