Possibly just a symptom of the earlier behavior, but I'll amend my
example, below, with an even more disturbing observation:

Am Sat, 23 May 2020 13:19:24 +0200
schrieb Thomas Friedrichsmeier via R-devel <r-devel@r-project.org>:
[...]
> Consider the code below:
> 
> makeActiveBinding("i", 
>       function(value) {
>               if (missing(value)) {
>                       x
>       } else {
>               print("set")
>               x <<- value
>       }
>       }, globalenv())
> 
> i <- 1     # output "set"
> print(i)   # output [1] 1
> 
> # Surprising behavior starts here:
> for(i in 2:3) print(i) # output [1] "set"
>                        #        NULL
>                        #        NULL
> 
> print(i)               # output NULL
> print(x)               # output NULL
> 
> i <- 4                 # output "set"
> print(i)               # ouput [1] 4
> print(x)               # ouput [1] 4

ls()
# Error in ls() : 
#  Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'NULL'

Regards
Thomas

Attachment: pgpq_90MQ_lQD.pgp
Description: Digitale Signatur von OpenPGP

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to