3 ms·
I'm not sure your first example is Apps Hungarian: indeed in the last segment he says that such an example is a bad variant thatis of no real usage. I too init
by ErrantX 18y ago
I'm not sure your first example is Apps Hungarian: indeed in the last segment he says that such an example is a bad variant thatis of no real usage.
I too initially thought "how great would it be to compile some of these prefixes into a language" but after readign through I think it would be difficult.
The intent is that the prefix describes what the variable is not what type it is. And so the prefix will vary from project to project.
However your example of specifying type is inherently possible and many languages DO do it (not with the prefix - they just check for type at compile time). The point, I think, Joel is making is that the Hungarian convention is a way for the programmer to vet the code as he browses it. Identifying errors and logic clashes etc. :)
- rtra 18y agoAnd indeed a programmer can vet the code as he browses it, by using a data type like the one I gave above, just by making sure all user input methods have type UnsafeString, and all output methods had type String, with UnsafeString as an abstract data type.
- ErrantX 18y agoyes but your still stuck on type there... those are things that can easily fail (or be made to file) at the compiler or on runtime. What about logic errors - which is what this is supposed to help fix?