lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Given wrote:
That said, though, I have seen a variant of HN used very successfully on the
EPOC platform: it used prefixes to indicate the *kind* of each symbol. That
is: type (T), class (C), handle (R), enumeration (E), instance data (i) or
argument (a). (Locals were untagged.) They were programming in C++, which
makes a lot of this kind of thing necessary.

I dropped special notation for function arguments, I see them as local variables...


Most people find themselves distinguishing different kinds of identifiers;
Java and C++ both tend to have ClassNames, functionNames,
_private_instance_data, and ordinary_locals.

I often see (and use) the variant:
ClassNames, FunctionNames (yes, same notation, but that's not ambiguous, is it?), m_memberVariable, ordinaryLocals.


Thus, I don't like functionsNames enforced in Java, but I stick to it, force of the crowd...

This information *is* technically part of the type and so is strictly
unnecessary, but doing this kind of thing can make your life much easier. For
example, the hoary old C++ problem of:

struct Class {
	int left;
	int right;

	Class(int left, int right)
	{
		// Um...
	}
};

Indeed, instead of doing, in Java: this.left = left; it allows to do the more elegant (IMHO): m_left = left; or, to use other notations: _left = left; or left = aLeft; etc.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --