Type | Bug | Status | pending | Date | 14-Mar-2014 19:25 |
---|---|---|---|---|---|
Version | r3 master | Category | Native | Submitted by | BrianH |
Platform | All | Severity | minor | Priority | normal |
Summary | APPLY should work with DO function |
---|---|
Description |
APPLY is used to provide an argument block to a function, controlling the argument evaluation. It's mostly used for function wrappers and function security. DO function, however, corresponds to two function calls, the call to DO and the call to the function, each with its own set of arguments. At the moment, APPLY only controls the first function call, to DO. The second function call is not controlled. APPLY should remove the redo flag from the return value of the call to DO, so the second function call can be handled by a chained call to APPLY, with a second argument block. Or not called, it should be up to the caller, that is the point of APPLY. There are also security implications, as the second function call can be used to gather arguments that you don't want gathered, such as bound hidden words, unencrypted values, whatever. It's not as big a deal in this case because someone would have to get both DO and the malicious function to the point of call, and the initial apply block has to be DO compatible. Still, better safe than sorry, especially since the new behavior is a better fit for APPLY's purpose. |
Example code |
; Current behavior >> apply :do [:add] 1 1 == 2 ; Preferred behavior >> apply apply :do [:add] [1 1] == 2 >> same? :add apply :do [:add] == true |
Assigned to | n/a | Fixed in | - | Last Update | 5-Mar-2015 06:55 |
---|
Comments | |
---|---|
(0004367)
Ladislav 14-Mar-2014 20:07 |
I am not sure, is this the desired behaviour? (does not look exactly natural to me) |
(0004368)
BrianH 14-Mar-2014 20:34 |
Well, if you want it all in one block then the equivalent call would be
>> apply :do [:add none none none none 1 1] == 2 Remember DO's optional arguments, which are normally padded in. And you wouldn't be able to block the reval altogether, which is the primary reason for this proposal. If you wanted something more like DO, you could call DO directly. You use APPLY to be able to have more control over the evaluation. APPLY is not DO. |
(0004568)
BrianH 23-Feb-2015 11:41 |
It's not "built" until it's merged. |
(0004574)
BrianH 2-Mar-2015 10:29 |
The PR link you wrote was for #2121. The PR for this one is https://github.com/rebol/rebol/pull/210 |
(0004587)
abolka 5-Mar-2015 06:55 |
Right, sorry for the noise. |
Date | User | Field | Action | Change |
---|---|---|---|---|
5-Mar-2015 06:55 | abolka | Comment : 0004569 | Removed | - |
5-Mar-2015 06:55 | abolka | Comment : 0004561 | Removed | - |
5-Mar-2015 06:55 | abolka | Comment : 0004587 | Added | - |
2-Mar-2015 10:30 | BrianH | Status | Modified | built => pending |
2-Mar-2015 10:29 | BrianH | Comment : 0004574 | Added | - |
23-Feb-2015 11:57 | abolka | Status | Modified | pending => built |
23-Feb-2015 11:57 | abolka | Comment : 0004569 | Added | - |
23-Feb-2015 11:41 | BrianH | Comment : 0004568 | Added | - |
23-Feb-2015 11:40 | BrianH | Status | Modified | built => pending |
26-Jan-2015 07:47 | abolka | Status | Modified | submitted => built |
26-Jan-2015 07:47 | abolka | Code | Modified | - |
26-Jan-2015 07:47 | abolka | Description | Modified | - |
26-Jan-2015 07:47 | abolka | Comment : 0004561 | Added | - |
14-Mar-2014 20:34 | BrianH | Comment : 0004368 | Added | - |
14-Mar-2014 20:10 | Ladislav | Comment : 0004367 | Modified | - |
14-Mar-2014 20:07 | Ladislav | Comment : 0004367 | Added | - |
14-Mar-2014 19:25 | BrianH | Ticket | Added | - |