From maechler at stat.math.ethz.ch  Mon Mar  7 18:26:25 2016
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Mon, 7 Mar 2016 18:26:25 +0100
Subject: [Rd] body(NULL) <- something;  ditto formals() -- should not work
Message-ID: <22237.47553.217160.571753@stat.math.ethz.ch>

I'm proposing to signal an error (from R >= 3.3.0) in such
examples -- which do "work" in R 3.2.x and earlier :

> f <- NULL; body(f) <- quote(sin(a+1)); f
function () 
sin(a + 1)
<environment: 0x48f9798>

> g <- NULL; formals(g) <- alist(x = pi, y=); g
function (x = pi, y) 
NULL
<environment: 0x4e6dfe8>
>

The proposal is that the underlying C code will signal an error
when such replacement functions would create a function out of
"something not a function".

Martin Maechler, ETH Zurich



[Rd] body(NULL) <- something; ditto formals() -- should not work
Martin Maechler