lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

steffenj wrote:
[...]
> Yep. I say: "prefix values with a single lowercase character to signal their
> type". And i get "hungarian notation" in my face. I was like "Woaaah - don't
> go there, don't even THINK about it!". :)

A lot of MS developers still get late night flashbacks on the horrors of
Hungarian Notation. As you said, let's not go there.

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.

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

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...
	}
};

Lua, of course, tends suffer from this because it doesn't have the rigourously
hierarchical scopes that C++ does. Object instance accesses are mostly
explicit ("self.left = left"), but some closure-based OO systems may benefit
from something similar...

- --
+- David Given --McQ-+ "If you're up against someone more intelligent
|  dg@cowlark.com    | than you are, do something insane and let him think
| (dg@tao-group.com) | himself to death." --- Pyanfar Chanur
+- www.cowlark.com --+

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDGOYjf9E0noFvlzgRAiM+AJ9zcF3b9V9KdrDpMsK5wnisz7VMlwCg1pKn
iBukeudK+oWYC4UZYx66eNU=
=y+Yy
-----END PGP SIGNATURE-----