CamelCase versus wide_names (Prothon)
Doug Tolton
dtolton at nospam.org
Fri Apr 16 17:47:11 EDT 2004
Terry Reedy wrote:
> "Wilk" <wilkSPAM at OUTflibuste.net> wrote in message
> news:87wu4gjkwb.fsf at blakie.riol...
>
>>Why not - instead of _ ?
>
>
> I believe some Lisps do use -. If so, they can do so because of the prefix
> and space-separator syntax:
>
> (- a-c c) is unambiguously a-c - c
>
> Terry J. Reedy
>
>
>
>
Terry,
You are right, in fact all Lisps that I've used use a hyphen as the
convention for variable separators.
(defun my-function (this-is-a-variable another-variable)
(run-another-function this-is-a-variable another-variable))
Above is a rather verbose example of some lisp code. Lisp uses
whitespace as token delimeters which opens up some very interesting
possibilities for variable names such as *a-global-variable* and many
others. The hyphen I find is by far the easiest, most natural and
visually appealing method for concatenating words IMO (it happens to be
the method we use in english as well), it also requires the least amount
of keystrokes. However the hyphen can only be used in a postfix or a
prefix notation as it is in Lisp. With an in-fix syntax like Python I
don't know how you could un-ambiguously determine the difference between
"a minus b" and an identifier named a-b.
Given the lisp background, I started out using mixedCase and
PascalCasing as a convention many years ago. I found out over the years
that people have a hard time deciding whether or not some words should
be all in caps, or only in intial caps (someone used an example above
something to the effect about theGui or theGUI or TheGUI or even
TheGui). A lot of people who love mixed-casing tend to minimize the
problems with this when using a case-sensitive language, but it gets
irritating always having to look up the casing on function calls.
Personally I like wide_names better than mixedCase in any language that
doesn't allow me to use the hyphen for tokens. My vote is that you
stick with wide names since you are modeling Prothon on Python. If you
were modeling it on Java or C#, then I would agree with mixedCase. Of
course this is an aesthetic issue and taste varies wildly on this issue.
At my place of employment we have agreed that whoever created the
module gets to determine the format (ie, mixedCase or wide_case). As
you can imagine we have an abundance of stylistic choices.
--
Doug Tolton
(format t "~a@~a~a.~a" "dtolton" "ya" "hoo" "com")
More information about the Python-list
mailing list