Subject: underscore (was Re: Gnomified:  Options, Paragraph, Font Dialogs)
From: Paul Rohr (paul@abisource.com)
Date: Tue Apr 04 2000 - 22:31:28 CDT
At 06:24 PM 4/4/00 -0500, sam th wrote:
>On Tue, 4 Apr 2000, John Tunison wrote:
>> PS. Also, while I'm getting up to speed here, what do underscores signify
>> in function names for Abi?  For instance, XAP_UnixDialog_FontChooser does
>> not use _create_window it uses create_window, while all the AP_UnixDialog
>> stuff I've seen uses _constructWindow.  
>
>Although I have no offical answer to this question, the understanding I
>have from the code is that _fun_ction does most of the real work, and is
>called inside the class, while fun_ction is used as part of the public
>interface.  The source code guidelines don't mention this. 
Whoops.  Guess we should update the guidelines, then.  All of the prefix 
conventions are intended to help communicate scope:
Classes, structures, enums, and constants are usually prefaced to help 
indicate the scope of the module they belong to.  For example:
  F*_  formatter
  --------------
  FV_  view
  FL_  logical layout
  FP_  physical layout
  P*_  piece table
  ----------------
  PD_  document abstraction
  PT_  underlying piece table
  framework stuff
  ---------------
  UT_  utilities
  GR_  graphics
  EV_  events
  etc. 
In addition, those prefixes are only capitalized if the intent is that those 
symbols should be accessible from oustide the module (usually built as a 
statically-linked library).  Symbols which are intended to be private to the 
module have a lowercase prefix (for example, fp_ vs. FP_).  
The methods of a class fall into the following equivalence classes:
  1.  class::publicMethod()
  2.  class::_privateMethod() ... actually, these are usually protected
  3.  class::s_staticMethod()
  4.  x_staticFunction()      ... not a method at all
Note that 3 and 4 tend to get blurred in practice.  
Paul
  
This archive was generated by hypermail 2b25 : Tue Apr 04 2000 - 22:25:55 CDT