28 ms·
> Don't use the same type for escaped and unespaced strings. And if you can't extend your type system to make this work, do it in your head, mutating the names
by derleth 14y ago
> Don't use the same type for escaped and unespaced strings.
And if you can't extend your type system to make this work, do it in your head, mutating the names of variables to help you keep it straight. For example, esStr and unStr are not of the same type, and moving data from one to the other without conversion is always an error.
- roc 14y agoWhich was one of the original and useful points of (apps) hungarian notation.
- nradov 14y agoThis reminds me of Charles Simonyi's classic article on Hungarian Notation. I know that style gets criticized a lot, but that's usually when it has been used inappropriately. If you have a language with a weak type system then a sensible variable prefix convention can help a lot. http://msdn.microsoft.com/en-us/library/aa260976(v=vs.60).aspx http://msdn.microsoft.com/en-us/library/aa260976(v=vs.60).as...
- eru 14y agoAnd you might even write a `lint' like source auditer to warn you about those conversions, even if your compiler doesn't.