-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
Milestone
Description
It would be great if it would be possible to use (global) variables. Similar to less these could be prefixed by '@'. So that a variable gets global, it should first be used in global space. Example (similar to #77, but rather extending it):
/* initialize variable @list with an empty list, making it global */
@list: list();
/* process all peaks ordered by elevation downward */
node[natural=peak]:order-numerical-desc(ele) {
/* to @list append the name of the current map feature */
@list: append(@list, tag("name"));
}
/* print current @list to stderr, which should be the names of all peaks
* in current bounding box, ordered by elevation downward */
debug(@list);The following things need to be implemented:
- variables, which are names prepended by @
- check reserved names
- statements in global space, even without destination where the result should go to (like the
debug()in the last row). - use variables inside of eval statements
- delay execution of map features if rules after a global statement use/modify a global variable
How to do?
- save block of global statements as if they are a normal rule
- compile as a function similar to check_X, execute from main loop with list of other objects