Closed GiselleSerate closed 6 years ago
Does this include too much overhead? I was considering this while reading...I don't think it does. The only thing it does is define extra variables and check if they exist. It would introduce a lot of extraneous environment variables, but I guess as long as we prefix them such that no one would accidentally use them or want to use them, it'll be fine.
Ideas: USE_MYALIASES_NAV DEFINE_MYALIASES_NAV MYALIASES_NAV_DEFINED
Also, I don't think we necessarily need a standard, but because this is going to be an environment name instead of just a program wide name, we should be extra careful about that.
I'm also extremely conscious of the fact that this is a very C-like solution with very C-like variable naming conventions.
Alternatively, if you don't want to define variables, you can grep the .included
file for a string instead, which narrows the search scope and also doesn't clutter the namespace. This limits mess and puts the burden on the person who wants to include stuff rather than the person whose stuff is being included. They would need to embed their write to file inside an if statement. Except if you delegate all of that to the setup script, then the setup script is the only one who has to worry about that.
I think this is a better solution than include guards.
Looks like I did this.
You could source each file individually. But for safety, simulate include guards from C? Like how you use ifndef. Shouldn't be terrible to implement, but you'd just have to do it for every file.