std.locale

Walter Bright newshound1 at digitalmars.com
Mon Mar 2 11:45:49 PST 2009


Christopher Wright wrote:
>> -- All very nice, but no cigar. That's about as smart as letting 
>> people define *unlimited* length variable names!)
> 
> I recently dealt with a programming language that specified a limit of 
> 63 characters for identifier names. This wouldn't have been a 
> significant problem, except that I was generating code automatically, 
> and some of my identifiers were over 90 characters. Identifier length 
> limits are evil, unless they're ridiculously large (C#, I think, limits 
> identifiers to 4096 characters).

As soon as you put in a limit on identifier name length, sooner or later 
you'll get a bug report on it.

For example, C++ can be compiled to C code. C++ templates encode their 
entire state into the template instance identifier, and these can easily 
reach 10,000 characters or more. So if your C compiler has a length 
limit on identifiers, then C++ templates become severely limited.

Another thing to consider is it's actually *more* work to put a limit 
on, where you have to document it, explain it, detect it, diagnose it, 
recover from it, than if you just make it unlimited.

There are really only 3 numbers in computer programming: 0, 1, and 
unlimited. I always chuckle when I see an ad for like, an editor, that 
says "up to 5 files open at once!".



More information about the Digitalmars-d mailing list