[ESS] tip for navigating camelCase

A.J. Rossini blindglobe at gmail.com
Mon Nov 8 08:16:03 CET 2010


On Sun, Nov 7, 2010 at 10:42 PM, Vitalie S. <spinuvit.list at gmail.com> wrote:
> Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> writes:
>
>>> For what it's worth, I've gone with Google's style guide
>>> for the most part.
>>>
>>> Hope that explains my rationale for including the
>>> mixed case (aka camel case) discussion as it applies
>>> to R using ESS!
>>
>> Thanks for this Erik.  I would love to see some standardization in this
>> respect, but fear that too many people have too many differing styles.
>> e.g. I have previously used . (and hardly ever touch underscore) a lot
>> in R.  Looking at code in R (e.g. just browse the release notes for
>> 2.12.0) and you will see several styles used for function names
>> (although I don't see much use of underscore).
>>
>> Anyone from r-core care to comment -- is there a policy for new code?
>> (I appreciate that a lot of old function names are inherited from S).
>
> S4 can be considered a "new code" and given that R is becoming more and more
> S4-rish that is probably the way to go.
>
> As far as I can see S4 is written in camelCase almost exclusively:
>
> - functions start with small letters and try to give as complete description by
>  means of an action verb (i.e. setRefClass, getMethod)
>
> - non exported functions start with "."
>
> - variables are also camelCased but tend to be shorter and start with
>  a noun (i.e. elNames, envRefClass)
>
> Personally,-I-love-lisp-style.

I generally do camelcase (and generally follow the above
reverse-engineered approach of Vitale, but do
wish/that-one/could-write=lisp/style-variables  (like that one).  Only
problem with lisp style is that camel case doesn't really work (except
in the rare case of mix-case lisps).

I really, really avoid both _ and .   , the first being historically
confusing, and the second possibly ending up with inadvertent S3
overload (except for the "hidden stuff" approach described above).

best,
-tony

blindglobe at gmail.com
Muttenz, Switzerland.
"Commit early,commit often, and commit in a repository from which we
can easily roll-back your mistakes" (AJR, 4Jan05).

Drink Coffee:  Do stupid things faster with more energy!



More information about the ESS-help mailing list