Should not evaluate delayed-assign object before it gets called
See original GitHub issueDescribe the bug
VSCode-R evaluates the delayed-assign object too early.
To Reproduce
- Open VSCode (with VSCode-R installed)
- Open the radian terminal in VSCode
- Paste the following code in to the radian terminal
delayedAssign("delayed_obj", {
stop("should not execute")
})
in VSCode’s terminal
The code inside has been executed but it shouldn’t as delayed_obj
is not evaluated
in a normal terminal
The code inside is executed only when delayed_obj
gets evaluated
Do you want to fix by self? (I hope your help!)
Yes
(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)
I want to know where to get started…
(If related)setting.json
{
"remote.SSH.connectTimeout": 30,
"remote.SSH.maxReconnectionAttempts": 5,
"remote.SSH.remotePlatform": {
"10.4.119.58": "linux",
"10.4.120.45": "linux"
},
"r.sessionWatcher": true,
"r.rterm.windows": "D:\\app\\Python\\Python39\\Scripts\\radian.exe",
"r.rpath.windows": "D:\\app\\R-4.0.0\\bin\\R.exe",
"diffEditor.renderSideBySide": true,
"[r]": {
"editor.formatOnSave": false
},
"git.autofetchPeriod": 300,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"window.zoomLevel": 0,
"r.lsp.diagnostics": false,
"git.confirmSync": false,
"r.alwaysUseActiveTerminal": true,
"r.bracketedPaste": true,
"diffEditor.ignoreTrimWhitespace": false,
"git.autofetch": true,
"editor.tabSize": 2,
"terminal.external.windowsExec": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"typescript.suggest.paths": false
}
Expected behavior
Should not evaluate the delayed-assign object so early - we should only evaluate the object when we really need it
Screenshots
See the comment in Reproduce Step
Environment (please complete the following information):
- OS: Win 10
- VSCode Version: 1.52.1
- R Version: 4.0.2
- vscode-R version: 1.6.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
delayedAssign: Delay Evaluation - Rdrr.io
The expression assigned to a promise by delayedAssign will not be evaluated until it is eventually 'forced'. This happens when the variable is...
Read more >Lazy evaluation in R – is assign affected? - Stack Overflow
delayedAssign is a low-level function, visible to R users/programmers, but it really is only used for lazy loading of packages and should not...
Read more >What is a Function? · R and C++ - Kevin Ushey
This demonstrates R s lazy evaluation of function arguments. When R binds formals to the local generated function environments, it does so with ......
Read more >Should not evaluate delayed-assign object before it gets called
VSCode-R evaluates the delayed-assign object too early. To Reproduce. Open VSCode (with VSCode-R installed); Open the radian terminal in VSCode; Paste the ...
Read more >[Rd] Substitute / delayedAssign (was: Substitute unaware when ...
After conversion, each expression in the list will be automatically evaluated when the variable with the same name is accessed in the environment....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the easiest way is to use
rlang::env_binding_are_lazy(.GlobalEnv)
.Well, the relevant code already depends on jsonlite. So adding a further tiny package should not make the installation process much harder.