Phobos examples and auto

Jonathan M Davis jmdavisProg at gmx.com
Tue Nov 8 10:58:59 PST 2011


On Tuesday, November 08, 2011 10:43 Tobias Pankrath wrote:
> Jonathan M Davis wrote:
> > On Tuesday, November 08, 2011 17:25:57 Marco Leise wrote:
> >> After some hacking into the keyboard layout file, I now use the alias ℕ
> >> (the mathematical symbol for the non-negative integral number)
> >> everywhere instead of the ugly size_t. It is even shorter than 'auto'.
> >> 
> >> ℕ i = 5;
> >> ℕ j = i;
> >> ℕ k = j;
> >> ℕ l = k;
> >> 
> >> ;)
> 
> No need for hacking, if you use www.neo-layout.org. I've learned it last
> year. Biggest improvement of my human-computer interface for years.
> 
> > but that's really bad practice
> > if you intend anyone else to ever read your code. If it's just for you,
> 
> then you obviously can do whatever you want, but size_t is the correct name
> 
> > and what others are going to expect if they ever read your code.
> 
> Only because it's an alias for an build-in type, that is unnecessary. You
> could say the same thing about every other typedef. The reason, why this is
> bad practice is, that almost no one can easily write that type with a
> QWERTY keyboard.

It's bad practice on both counts. Creating an unnecessary alias (especially 
for a built-in type) just serves to obfuscate code and confuse other 
programmers. Regardless of the name chosen, it shouldn't be done. And as cool 
as it may be to be able to use unicode in a .d file, unicode characters are 
not typeable on most keyboards, so using unicode characters for anything 
outside of strings is generally a bad idea.

- Jonathan M Davis


More information about the Digitalmars-d mailing list