import/namespace system
Posted: 21 Mar 2018, 19:43
I had the idea that AHK might benefit from a bit more robust #Include system than what it currently does.
While I really do enjoy the import/export system of JavaScript, I think that would be quite overkill, at least to start.
My proposal would be to add a new # directive that would be used the file to be included. I imagine this being used mostly for all of the various function libraries out there that are typically included. My suggestion would be to use something like #Using <namespace> or #namespace <namespace>. When that file is included, all of its variables/functions/classes would be found under that single namespace. I suppose an alternative would be to simply wrap all of the variables/functions/classes into a class and use them all as static definitions.
Maybe its not a good idea. Just thought it might help with the issue of global namespace pollution... and with people prefixing their functions with weird things like initials and etc.
Beyond that, using an import system like JavaScript or Python would be neat to only import what you need. I can be optimistic
While I really do enjoy the import/export system of JavaScript, I think that would be quite overkill, at least to start.
My proposal would be to add a new # directive that would be used the file to be included. I imagine this being used mostly for all of the various function libraries out there that are typically included. My suggestion would be to use something like #Using <namespace> or #namespace <namespace>. When that file is included, all of its variables/functions/classes would be found under that single namespace. I suppose an alternative would be to simply wrap all of the variables/functions/classes into a class and use them all as static definitions.
Maybe its not a good idea. Just thought it might help with the issue of global namespace pollution... and with people prefixing their functions with weird things like initials and etc.
Beyond that, using an import system like JavaScript or Python would be neat to only import what you need. I can be optimistic