Open hiiamboris opened 4 years ago
If set-words have a different behavior, based on whether they follow a keyword, it seems like it will complicate parse
, possibly leading to more bugs and work, offsetting gains from this feature. The alternative, to prep a func at the mezz level, adds to the number of func-making funcs we already have, and being very specialized. And it will have a long name if we specialize it to this purpose. :^\
I don't think that allowing set-word!
after set
or copy
command could complicate anything. And parse rules are really common source of leaked variables.
s: 1 f: function[][parse ["abc"][set s string!]] f
I think current behavior is consistent with main Red syntax. I wouldn't expect s
to not leak, because it's the same with normal set
function:
>> s: 1 f: function[][set 's "xyz"] f
== "xyz"
>> s
== "xyz"
@loziniak I hope you're not trying to say that you're a fan of the tedious procedure of manually detecting newly introduced words and extracting them out of the Parse rules (;
@hiiamboris I hope you're not trying to say that modal keyword one-shot relays are a free lunch. ;^)
I accept a slight readability price, same as with set [x: y: z:] stuff
(;
Allow:
set word: rule
copy word: rule
as an alternative to:set word rule
copy word rule
so thatword
can be automatically localized byfunction
s (else it's always a source of bugs and manual labor after every refactor)