Type | Issue | Status | submitted | Date | 29-Jul-2015 15:09 |
---|---|---|---|---|---|
Version | r3 master | Category | Unspecified | Submitted by | fork |
Platform | All | Severity | minor | Priority | normal |
Summary | PROTECT/DEEP of lit-word or lit-path should error |
---|---|
Description |
PROTECT 'FOO and PROTECT FOO are different; one protects a word from being used to change the variable to which it is bound, and the other protects the value itself. So for protecting the value: >> foo: [a [b c] d] >> protect foo >> append foo 'muhaha ** Script error: protected value or series - cannot modify ** Where: append ** Near: append foo 'muhaha >> foo: 10 == 10 In contrast, protecting the word: >> foo: [a [b c] d] >> protect 'foo >> append foo 'muhaha == [a [b c] d muhaha] >> foo: 10 ** Script error: protected variable - cannot modify: foo: But the /DEEP refinement does something weird with the lit-word (or lit-path) protect, to suddenly mean you want to protect the word *and* the series: >> foo: [a [b c] d] >> protect/deep 'foo >> append foo 'muhaha ** Script error: protected value or series - cannot modify ** Where: append ** Near: append foo 'muhaha >> append foo/2 'muhaha ** Script error: protected value or series - cannot modify ** Where: append ** Near: append foo/2 'muhaha >> foo: 10 ** Script error: protected variable - cannot modify: foo: It's a little tricky to begin with, but this just makes things worse. /DEEP should be an error if the target is just a word or path lookup itself. This would help prevent cases where people accidentally wind up protecting the word when they really meant to protect the value deeply. |
Example code |
Assigned to | n/a | Fixed in | - | Last Update | 29-Jul-2015 15:15 |
---|
Date | User | Field | Action | Change |
---|---|---|---|---|
29-Jul-2015 15:15 | Fork | Description | Modified | - |
29-Jul-2015 15:09 | Fork | Ticket | Added | - |