Page 1 of 1

private include

Posted: Wed Feb 18, 2009 8:26 am
by saum
Does what standard include does, but is not transitive.

There are a few annoying issues with include:
1) slows down compilation
2) naming conflicts
3) global variables (unlike functions) get included into files which don't use them + get initialized. This is pretty bad - yesterday I noticed our singleclick hook was executing around 210 redundant (out of 250 total) instructions because of included global variables initialization (31 of them).

I know this can be partially avoided by proper coding style, but its not easy with with 2500+ .src and 1000+ .inc files written by a few tens of scripters (most of them were not professional programmers) over the course of 7 years.
Private include would make things a lot easier for us.

EDIT: As was pointed out to me this is not possible since .inc files are not compiled. I'll leave it here, maybe someone can think of a solution.