in reply to Re^3: Finding out whether a module contains a certain package
in thread Finding out whether a module contains a certain package
I think you can forget about catching all possible cases. Considering that the majority of the people will write package Abc; near the top of the file, and all you seem to want is earlier program termination,...
Actually, I don't want to terminate earlier; I want to throw an exception (which will be handled by our central exception handler) and continue with the next task (which hopefully will go well); the problem with the MixinFactory was that it did not terminate with an exception, but terminate ungracefully.
But this is a minor issue. Basically, I agree with you; and especially since we have control about how the "good" files look like, I will follow your advice and, instead of respecting all pathological cases, require that a good mixin module has to have a package declaration of a certain form near the top of the file; and I will reject everything modules which don't match this pattern.
|
|---|