![]() Irrelevant if someone else is actually using it or not, I'm just proposing you use proper code structure.Alphabetical Command and Function Index | AutoHotkey Alphabetical Command and Function IndexĬlick on a command or function name for details. The last thing someone would want to do is to scour their code looking for that if it's not their express intent. However, this should always be implemented explicitly, as everything global should be. To re-iterate once more, a function should never have a global effect unless it's contained (opened-closed), with onMessage() being one of the few exceptions. This notifies the coder immediately what they're getting into in that it will act on-message. What you're wanting to do seems to be to break proper use of a function.Įdit: Specifically, with your case, you should use my proposed method of including the file. Globals/super-globals are discouraged due to the inherent flaw of the function no longer being self-contained, being reliant on an outside variable it expects to be named correctly. Variables in the regular namespace should be used to save any information needed at startup or otherwise, then pass it into the function.But, as noted, a function should be completely self-sufficient anything it opens globally/system-wide, like a file handle, should be closed, unless it's specifically meant to open and return a handle. ![]() Static variables are a good way to make sure things are instantiated properly within a function.Not sure what you're aim is, but here are some proper usages: If you need a function to unconditionally run on the start, I think you need to re-think your approach. It's not suppose to have any dealings with the script globally. A function is just that, a function, or contained-code.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |