[Rd] print.<strorageMode>() not called when autoprinting

Lionel Henry ||one| @end|ng |rom r@tud|o@com
Wed May 22 16:25:46 CEST 2019

Hi Martin,

> On 22 May 2019, at 03:50, Martin Maechler <maechler using stat.math.ethz.ch> wrote:
> I'm pretty sure that all teaching and documentation about S and R 
> has suggested that  print(f)  and auto-printing should result in
> the same output _ AFAIR also for S4 objects

I agree with the principle that autoprint and print() should be
equivalent for users. However it also seems that print calls in
packages should be independent of user customisations. For instance a
package author might gather tabular data in a matrix or data frame and
print() it as part of a larger print method. In that case, user
customisations might cause a mess.

Would it make sense to resort to autoprint customisation when the
topenv() of the parent.frame() of print() is the global environment,
and ignore the customisation otherwise? This should ensure consistent
printing behaviour at the REPL and in scripts. Checking the topenv()
allows print() calls inserted to debug lapply'd functions to behave the
same as when called from top level or within a loop.


More information about the R-devel mailing list