[plt-dev] request not to use all-caps identifiers
As the originator of the variable, I have to say I'm not terribly
bothered by all caps used sparingly.
I use caps (only this once as far as I know) to signify: wacky
constant coming up.
My use doesn't have anything to do with Java. (I've never written a
Java program longer than 10 lines.) It is more likely to have
something to do with C.
If I wanted to be a pain, I could say I'm going back to our roots when
everything was in caps. (Whenever I look at books that present Scheme
in all caps it is soooo disturbing. Blech.)
Jay
On Mon, Apr 12, 2010 at 7:26 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> I just noticed this variable named "TEXT/HTML-MIME-TYPE" in the excellent
> Web server API, and wanted to request that PLT not get in the habit of using
> all-caps.
>
> As far as I know, the reason Java kids use all-caps for constants is an
> artifact of 1970s C, and no longer makes sense. C had no "const" at the
> time, and compilers and computers were very limited, but they did have the C
> preprocessor. So people used preprocessor macros for constants. The C
> preprocessor was very crude and ill-conceived by Scheme syntax extension
> standards. It was easy to break your code because you unknowingly used a
> preprocessor macro that, say, expanded to function call with side effects
> despite looking like a variable reference, or reassigned your variables, or
> expanded to more than one expression, or even expanded to an incomplete
> expression or statement. Because preprocessor macro names were identifiers
> just like variable and function names, a naming convention of putting macro
> names in all-caps helped to flag this bit of code that did not behave as a
> variable or function. Then, when Java was being developed, the professional
> programmers for whom it was originally targeted were at the time C and C++
> programmers, so Java was made to look a lot like C++. (Ironically, it was
> the analogue of COBOL and 4GL programmers who became most of the Java
> programmers, not the embedded systems, technical, and shrinkwrap developers
> who wanted the language to look like C/C++.) Some Java person must've
> thought that using all-caps for constants was a good idea, because, hey,
> that's how it's done in C++, so they started doing that in Java, even though
> Java did not have the dangerous preprocessor and it did get "const". So now
> you see Java programmers writing "someFooBar =
> OMG_LOOK_OUT_HERE_COMES_A_CONSTANT_IT_COULD_BE_ANYTHING_BUT_OH_WAIT_ITS_JUST_A_CONSTANT_WHICH_IS_ONE_OF_THE_MOST_BENIGN_THINGS_POSSIBLE_NOT_A_CPP_MACRO_SO_I_GUESS_WE_SHOULD_CALM_DOWN_AND_STOP_SHOUTING;"
>
> --
> http://www.neilvandyke.org/
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-dev
>
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay
"The glory of God is Intelligence" - D&C 93