Skip to content

Commit 942709c

Browse files
author
maechler
committed
structure(NULL, <n> = v) is defunct now (also illegal for primitives)
git-svn-id: https://svn.r-project.org/R/trunk@88075 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 06906fa commit 942709c

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

doc/NEWS.Rd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
}
5050
}
5151

52+
\subsection{DEPRECATED AND DEFUNCT}{
53+
\itemize{
54+
\item \code{structure(NULL, <name> = <val>)} is now defunct.% deprecated r71841, 2016-12-27
55+
}
56+
}
57+
5258
\subsection{BUG FIXES}{
5359
\itemize{
5460
\item Setting \code{attributes} on primitive functions is an

src/library/base/R/structure.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# File src/library/base/R/structure.R
22
# Part of the R package, https://www.R-project.org
33
#
4-
# Copyright (C) 1995-2019 The R Core Team
4+
# Copyright (C) 1995-2025 The R Core Team
55
#
66
# This program is free software; you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -21,8 +21,7 @@
2121
structure <- function (.Data, ...)
2222
{
2323
if(is.null(.Data))
24-
warning("Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.\n Consider 'structure(list(), *)' instead.")
25-
## to become: stop("attempt to set an attribute on NULL")
24+
stop("attempt to set an attribute on NULL")
2625
attrib <- list(...)
2726
if(length(attrib)) {
2827
specials <- c(".Dim", ".Dimnames", ".Names", ".Tsp", ".Label")

src/library/base/man/Primitive.Rd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
}
4141
\examples{
4242
mysqrt <- .Primitive("sqrt")
43+
try(structure(mysqrt, comment = "primitive function")) # no more possible
4344
c
4445
.Internal # this one *must* be primitive!
4546
`if` # need backticks

src/library/base/man/structure.Rd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/structure.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 1995-2007 R Core Team
3+
% Copyright 1995-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{structure}
@@ -11,7 +11,9 @@ structure(.Data, \dots)
1111
\alias{structure}
1212
\arguments{
1313
\item{.Data}{an object which will have
14-
various attributes attached to it.}
14+
various attributes attached to it. From \R 4.6.0, this must not be
15+
\code{\link{NULL}} (previously deprecated for years), nor any
16+
\code{\link{symbol}} or \code{\link{primitive}} function.}
1517
\item{\dots}{attributes, specified in \code{tag = value}
1618
form, which will be attached to data.}
1719
}

0 commit comments

Comments
 (0)