Skip to content
Prev 52436 / 63424 Next

problem in levels<- and other inconsistencies

Herv?,
?
Good point, but easy to solve:
?
since 

list[i] # always is.list

deleting a list element with

list[i] <- NULL # !is.list(NULL)

does not lead into a contradiction

whereas 

list[[i]] <- NULL 

should do the same as 

list[i] <- list(NULL)

YES, I know that this would be major change, but NO, this is no justification to not fix a mistake in a language. Unless one has given up to fix the language, in which case we all should switch to another one (Julia, ...)

Jens
?
?

Gesendet:?Dienstag, 27. September 2016 um 23:20 Uhr
Von:?"Herv? Pag?s" <hpages at fredhutch.org>
An:?"Dr. Jens Oehlschl?gel" <Jens.Oehlschlaegel at truecluster.com>, r-devel at r-project.org
Betreff:?Re: [Rd] problem in levels<- and other inconsistencies
Hi,

I totally agree that having foo(x) <- foo(x) behave like a no-op
is a must. This is something I try to be careful about when I design
my own objects and their getters and setters.

Just wanted to mention though that there is notorious violation of
this:

x <- list(3:-1, NULL)
x[[2]] <- x[[2]]
x
# [[1]]
# [1] 3 2 1 0 -1

Now of course, not just because there is a precedent means the factor
API shouldn't be improved.

Cheers,
H.
On 09/27/2016 12:33 PM, Dr. Jens Oehlschl?gel wrote:
--
Herv? Pag?s

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fredhutch.org
Phone: (206) 667-5791
Fax: (206) 667-1319