PARSE: what is default value for SET?
For A84... I'd like to be sure we define the default value for SET of variables.
Currently the rule is: a variable will be SET only if its rule is successful. Otherwise, its value remains unmodified.
Example:
n: "y"
parse "a" [set n "x"]
?? n
"y"
The advantage is that you can setup the default easily.
The alternative is:
n: "y"
parse "a" [set n "x"]
?? n
none
I expect some of you have strong opinions one way or the other?
A possible solution is to provide a way to preset the variable within the parse rule (without a paren expression.)
BTW, this applies to COPY as well.
5 Comments
|