This is exactly what was used in GitHub - MasonProtter/ToggleableAsserts.jl: Assertions that can be turned on or off with a switch, with no runtime penalty when they're off. so that things would be recompiled if the assertion flag was flipped.
I’m not an expert, but I guess I’d just say it depends on what you mean by “overhead”. If it’s runtime overhead, the answer is no. If it’s compile time overhead, I’m not so sure. Certainly there is extra overhead from causing functions to be recompiled if you change the const, but the alternative is having your functions just not update which doesn’t sound very nice.