Not logged inOpenClonk Forum
Up Topic Functions in proplist constants, Effects

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Günther
Next design problem: The priority of local variables in functions declared in constant proplists.

For top-level-functions, there is a list of local variables, and functions are stored in the proplist. When parsing an identifier, it is looked up in these lists:
1. function parameter
2. function-local variable (var)
3. local variable
4. true, false, nil, new, if, while, else, for, return, Par, this, inherited, _inherited
5. functions (global functions are in the proplist via the prototype)
6. global variables
7. global constants

This order is pretty sane - the usual order from most specific to least specific, you can override keywords with code in the immediate vicinity, but not globally. The different rules for local functions and local variables are a bit odd, but not practically relevant. Except that I now have to decide where to put local variables in constant proplists. And whether to unify lookup of functions and variables for them.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill