Re: [R] weirdness in sourc()ing a dump() (bug?)

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Dalgaard (p.dalgaard@biostat.ku.dk)
Date: Fri 07 May 2004 - 00:21:31 EST


Message-id: <x2n04lk55g.fsf@biostat.ku.dk>

Prof Brian Ripley <ripley@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@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:08 EST