> That beeing said I think the main task of scripts is to get things done via
>running them end to end in a fresh session. Now, it very well may happen that
>a lot of stuff has to be done. Than splitting up scripts into subscripts and
>sourcing them from a meta script is a straightforward soluti
Definitely, I agree that global variables have a place in programming. They
play an especially important role in low-level software, such as embedded
programming, as you mentioned, and systems programming. I generally would
disagree with anyone that says global variables should never be used, an
Hi devel team,
I'm working on C/C++ level ALTREP compatibility for a package. The package
previously used pointers to access the data of a SEXP, so it would not work
for some ALTREP objects which do not have a pointer. I plan to rewrite the
code and use functions like get_elt, get_region, and get_
FWIW, one could imagine introducing a helper function global();
global <- function(expr) { eval(substitute(expr), envir = globalenv(),
enclos = baseenv()) }
to make it explicit that any assignments (and evaluation in general)
take place in the global environment, e.g.
> local({ global(a <- 2) })
> "Running R" (in "R Installation and Administration") links to
> "Appendix B Invoking R" (in "An Introduction to R").
> However, these sections do not cover the topics in this thread.
Sorry, I made a mistake.
It is in the documentation (B.4 Scripting with R)
e.g.
(excerpts only)
R CMD BATCH "--a
> this appears to disagree with the software-engineering principle of avoiding
> a mutating global state
I disagree.
In embedded systems engineering, for example, it's customary to use
global variables to represent ports.
Also, I note that the use of global variables, is similar to using pen
and
Hey,
I always found it a strength of R compared to many other langaugas that
simple things (running a script, doing something interactive, writing a
function, using lambdas, installing packages, getting help, ...) are very
very simple.
R is a commandline statistics program that happens to be a ve
> Duncan Murdoch
> on Mon, 26 Aug 2019 14:19:36 -0400 writes:
> On 26/08/2019 1:58 p.m., William Dunlap wrote:
>> Duncan Murdoch wrote:
>> > Scripts are for throwaways, not for anything worth keeping.
>>
>> I totally agree and have a tangentially relevant question