| 09-04-2008, 08:22 AM | #1 |
Can't scopes both have requirements and initializers? |
| 09-04-2008, 09:02 AM | #2 |
So I cannot put needs/uses/requires in a scope? |
| 09-04-2008, 10:04 AM | #3 |
It did :( |
| 09-04-2008, 10:06 AM | #4 |
... then use a library. The only advantage scopes have over libraries is that they can be nested. Sometimes. |
| 09-04-2008, 10:09 AM | #5 |
If nothing will require your scope then there's no reason to make it a library. Since all libraries are parsed before scopes a scope doesn't need the requires keyword at all. |
| 09-04-2008, 10:44 AM | #6 |
library pwns scope |
| 09-04-2008, 10:50 AM | #7 | |
Quote:
I tend to think of it the other way: if your library doesn't need nesting, there's no need to make it a scope. Plus libraries move the "this triggers requires system X" from the comments into the code, which is a good thing. Would you care to explain why you consider switching to libraries to be a cost? |
| 09-04-2008, 11:43 AM | #8 |
some people just don't want to use library, mostly because they have many requirements and specifying them is apparently a much bigger effort than calling their functions. "requires TimerUtils, initializer init" Even if that was a library it would cause a syntax error, initializer comes before requires and there is no comma separating initializer and requires. |
| 09-04-2008, 12:57 PM | #9 | |
Quote:
|
| 09-04-2008, 01:20 PM | #10 | |
Quote:
You can comment the requirements for libraries as well. The dependency list in code gives much better errors when uses make mistakes, though. "You're missing library X" vs "This line you don't understand calls a function you don't know about that isn't present in the map". I suppose there's some value if you always use it to distinguish spells ... kindof |
| 09-04-2008, 06:50 PM | #11 | |
Quote:
You can/should do both, think of this: The guy implementing the spell forgot to include one of the required libraries, if you used scope he will get plenty of "undeclared .... or expected a name, etc", if you used a library he will get "Missing library requirement ...." |
