Static foreach bug?

Dechcaudron no-reply at no-email.com
Wed Sep 5 11:19:04 UTC 2018


On Wednesday, 5 September 2018 at 10:45:20 UTC, Jonathan M Davis 
wrote:
> Too many people already think that the point of static is to 
> just make something be done at compile time (which is actually 
> a pretty terrible reason to use static) without adding that 
> sort of thing into the confusion.

Well, "static" in English means something that does not change 
(so do constant and immutable, but that's another story). One 
could argue that using static for function-scope variables with 
extended lifespan and for variables shared between instances of a 
class is more misleading. But since virtually every language out 
there uses them for that purpose, I understand we want to go with 
it. But then again, "static if" and "static foreach" make sense 
to me. And since all enums are compile time constants by 
definition, "static enum" may be a good way to tell them apart, 
although I do agree that it is far from ideal.

I understand that the syntax for CT if and foreach blocks is not 
going to be changed for good reasons now, but was something like 
"CTif" considered at the time? I know it doesn't "look" good as 
is, but maybe some small variation could have done the trick.

Rgds,
Dechcaudron


More information about the Digitalmars-d mailing list