Last active
October 10, 2020 07:15
-
-
Save nbhusare/6a8ec8e5c5ac5b3ecb2e8528b2da6078 to your computer and use it in GitHub Desktop.
Import declaration anti pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RPackage: | |
'pkg' name=QualifedName | |
importDec=ImportDeclaration?; | |
ImportDec: | |
'imports' '{'imports+=Import*'}'; | |
Import: | |
importedNamespace=QNWildcard; | |
Problems with the above grammar: 1) You have to overwrite `ImportedNamespaceAwareLocalScopeProvider#internalGetImportedNamespaceResolvers()`, and in that you have to write special handling code to deal with the `ImportDec` (PS code below), 2) In real world projects, you'll see 1000's of models files created, which means equal number of `ImportDec` are created in the memory. It increases the memory requirement, and also increases the work of the garbage collector. | |
Is this an antipattern? | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment