[racket] eginner's question on elementary textual replacement...

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri Mar 9 06:06:21 EST 2012

Thomas Chust wrote at 03/09/2012 05:41 AM:
> On Fri, 2012-03-09 at 05:16 -0500, Neil Van Dyke wrote:
>> [...]
>> CPP macros can cause many kinds of grievous syntactic breakage and
>> surprising bugs, and so all-caps as a warning is a great idea; Java
>> constants, on the other hand, are one of the safest constructs.
>> [...]
> Since this scenario is relatively common for both languages, I would
> disagree that Java constants are much safer and cleaner than CPP macros
> used as constants.

I meant that all-caps was appropriate for CPP macros because of the 
grievous syntactic breakage, such as unbalancing grouping token pairs, 
and worse.

Although "final"-hinted compiler optimizations can be dangerous for 
people who use "final" yet neither version their libraries nor compile 
their code when appropriate, I wasn't aware of an all-caps naming 
convention for "final".

If I understand correctly, you're saying that it's a happy accident that 
Java originally bastardized a convention from C, since *some* things 
that are all-caps for the wrong reason are coincidentally dangerous 
because of "final", although not all dangerous "final" things are in 
all-caps, so the happy accident only gets us so far? :)


Posted on the users mailing list.