Even when optimizing that stuff away, it's still going to throw syntax errors on garbage code : )
well u could just .. find the "if <exp> then" and "endif" and treat the body of the block as an opaque string until you have determined the static-ness and then parse only those branches that you cannot eliminate..
i say "just" but ofc it would be a bit haxy in your nice recursive descent parser..
also i don't see too much use in having static ifs whose content is syntactically unsound anyway.. i mean perhaps you *could* do *some* things more concicely.. but most likely that will have a bad effect on your code readability so you shouldnt be doing it anyway..
also.. there has been a lot of hot air over.. "you cant have a dangling if or endif inside there"
I think this says less about the language and more about your horrible code style. You can always achieve the same thing by just having a bit larger block inside the static if in stead of breaking it in to subatomic particles.
it will either work well..
or you have too much spaghetti code and you should be refactoring anyway
(wishlish += very good inlining so factoring out stuff like a civilised person wouldnt kill ur performance)
TLDR;
- You shouldnt put nonsense inside blocks even if you are technically allowed to
- I dont consider dissallowing total nonsense inside a static if a big issue