From Friedrich.Leisch@ci.tuwien.ac.at  Thu Jun 20 11:21:11 2002
From: Friedrich.Leisch@ci.tuwien.ac.at (Friedrich.Leisch@ci.tuwien.ac.at)
Date: Thu, 20 Jun 2002 12:21:11 +0200
Subject: a version of source() which keeps comments ?
In-Reply-To: <15633.43725.738497.292166@gargle.gargle.HOWL>
References: <15633.43725.738497.292166@gargle.gargle.HOWL>
Message-ID: <15633.44183.500647.714908@galadriel.ci.tuwien.ac.at>

>>>>> On Thu, 20 Jun 2002 12:13:33 +0200,
>>>>> Martin Maechler (MM) wrote:

  > I'd like to have this to be used in, e.g.,
  > demo() and example().

  > Currently, source() parse()s the entire file and then evaluates
  > expression by expression. ``Of course'',  parse() already loses
  > the comments.

  > An (much slower) alternative might be to the readLine() the
  > file, echo what we read, 
  > and try to parse() ``the current chunk''.
  > when parse() fails (when the current expression is incomplete),
  > we silently read the next line, etc, until the expression is complete and hence
  > parse() succeeds, then we eval() and print().

  > What do people think?

  > Would there be volunteers to write this?
  > [I think it should finalize as an optional argument to source(), 
  >  but for experimentation it might be easier to try with a
  >  function  sourceLinewise(.)
  > ].

I'm not a volunteer but the feature would also be extremely useful for
Sweave (and probably most other dynamic report approaches), where we
currently loose all comments in code chunks.

.f
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


a version of source() which keeps comments ?
Friedrich.Leisch@ci.tuwien.ac.at