explicit syntax for accessing class members and globals

Steve Horne stephenwantshornenospam100 at aol.com
Wed Sep 6 03:14:17 PDT 2006


On Tue, 05 Sep 2006 13:06:01 -0700, Sean Kelly <sean at f4.ca> wrote:

>It's obviously not enforced by the compiler, but I prefer a naming 
>convention

Agreed. But I'm not so sure about...

>     static int sm_val2; // "sm_" prefix for static members

To me, the fact that it is a member is sufficient. Context tells me
whether it's static, since my classnames have a 'c_' prefix.

l_Varname.m_Membername
  *Could* be a static, but much more likely an instance member.

c_Classname.m_Membername
  Must be a static member.

Actually, I'm amazed how quick and easy it has been replacing all the
'::' and '->' operators with a simple dot. I'm being spoiled. I may
have serious tantrums when I have to go back to C++ ;-)

Getting back to the point, I'm not particularly bothered by (for
instance) the explicit 'self' in Python, but I don't see it as an
advantage either. There are no major costs or benefits either way in
my opinion.

The important thing is that a language shouldn't make breaking changes
for the fun of it.




More information about the Digitalmars-d mailing list