About /local words
There's been some consternation regarding the use of the /local refinement for passing initial values to internal variables.
I'd have to admit that I didn't think this was an important issue... because all good functions initialize critical locals.
However, that's not true, is it? That's the old C programmer in me thinking in that way. Most of us REBOLers know that locals are initialized to NONE, so we depend on that fact.
The problem occurs when we use such uninitialized NONE values to produce important effects within our code.
I'm very much against requiring programmers to write code like this:
doit: func [arg1 /local loc1 loc2][
loc1: loc2: none
...
]
So, although the REBOL interpreter has no internal recognition of the /local refinement, perhaps it should.
Of course, any such change has a minor impact on performance, although it should be unnoticeable. It might also be possible to compensate for the extra check by using /local to terminate the function arg parse. In other words, /local must be the last refinement within the function spec. Any other's that follow it will be ignored.
Post your comments. We need to address this issue immediately.
20 Comments
|