[R] weirdness in sourc()ing a dump() (bug?)
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Thu May 6 16:21:31 CEST 2004
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> There is already a bug report PR#4364 on an aspect of this. The comment
> there is
>
> dump somehow needs to recognize that expressions in lists
> probably need to be enclosed in quote().
>
> S does exactly the same though
>
> (I think it is a symbol not a formal expression in the current examples.)
The comment and the report are both a little unclear. Objects of mode
"expression" are not the issue, since they do deparse/eval correctly.
Symbols and calls are.
> I believe it is rather difficult to determine what we cannot deparse
> successfully, and trying to issue a warning/error would give a false sense
> of security. The code (src/main/deparse.c) suggests that at least
>
> promises
> environments
> external pointers
> weak references
>
> will not get a useful textual representation. I don't think the goal can
> be as Peter describes -- it has to be more limited, and currently symbols
> are also on the list.
Yes, I know. I didn't mean a goal in the sense that it can always be
achieved. Promises can be forced, but the other types are not easy to
handle.(I don't think even save/load knows what to do with external
pointers.)
> (We might be able to solve symbols, but it is far
> from straightforward -- terms in formulae are symbols, for example, so we
> cannot just add quote() around symbols and that does indeed break code.)
Hmm, I thought the issue was that we need to quote calls but cannot
quote formulas (which are calls).
> There may well be others: it was not so long ago that integer vectors were
> dumped in a text representation that was read back in as numeric.
...so that we now have dput() output with as.integer() constructs all
over the place. (Can't have and eat, etc., I know.)
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list