myScript()Would be wrong if you use argument0 through argument15 in your code. You must now provide the correct number. Currently, it would initialise the variable to 0 (or false) if you hadn't passed it in. We consider this bad. It's an undocumented thing which should be avoided. if you mean 0, you should pass 0 in.
Now... this also got us looking at other issues. We have problems with folk creating arrays and touching element (say) 15, but then reading element 5. Again, this would be initialised to 0. This is again bad... but it would mean you have to "initialise the whole array.
So I'm currently looking to see if it's possible to throw an error in this case.
Now here's the question. What do you think should happen in these cases? The argument one is a no-brainer to me. It's dangerous, and it's a source of many a bug if you don't know what your doing. It's also a performance issue, as we need to clear 16 arguments every time we enter a function in case it accesses them. Now however, if you don't use args, we can detect that... and not clear anything, making script->script calling, faster (well.. a tiny bit).
The array access is different. We currently set the LAST element first to "size" the array, and know that our code will fill it all in first, but many folk I suspect will depend on the fact it'll be 0. What I'd prefer is for you to use some kind of DIM() command that would WIPE it if you needed 0, but if you didn't, you would get an error if you accessed an uninitialised element.
What do you think?
EDIT: Just been pointed out that printf() style calls would no longer work. So we'll make it so that argument[x] types are not effected by calling limits. Basically we'll assume you know what your doing if you access arguments via arrays.



This topic is locked








