On Dec 17, 2014, at 12:10 AM, Scott Robison <sc...@casaderobison.com> wrote:
> I loathe ... uh ... do not care for ... the embedding of scope or constness. g is easy to justify. It’s a heads-up to the programmer: “Pay attention, you’re looking at something that some other bit of code way over on the other side of the source tree could be changing on you!” It also prevents the old problem of “global i”. The trailing underscore for member variables (or leading m_, if you prefer) has a similar justification, only inverted: “No one else can see this; it’s private. Be careful exposing it, lest you break encapsulation.” For much the same reason, I hide member variables down at the bottom of the class declaration in languages that let me.[*] As for k, I think I just wasn’t clear about its use. It is not merely indicating a const qualifier, it is an assertion that you are dealing with a constant, rather than a variable. Its value remains the same for the entire program run time. For the most part, a ‘k’ value is either global, static, or a member of an enum. Variables which merely happen to be const-qualified in this particular context — such as a function parameter — do not get a k prefix. I let the compiler enforce constness. By the way, I forgot to mention one rule of my system: const int is always just k, not kn. FP constants are kf, mainly because floats are weird enough that special attention should be called to them, to keep the programmer alert. > I prefer not to sound like I'm coughing up a furball if I'm discussing source > out loud. :) You talk to _other people_??! :gobsmack: :) [*] Oddly enough, the ML family members I praised in the previous post are among those that don’t let me hide member variables at the bottom of the class definition. They don’t let you use something before it has been defined, and there is no forward declaration feature, only definition. The consequence is that the first thing you see when you open a source file is the deepest internals. It feels like wearing your underwear on the outside of your pants. _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users