[Rd] about REPL and loops in general ...
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Fri Aug 29 11:10:51 MEST 2003
Simon Urbanek <Simon.Urbanek at math.uni-augsburg.de> writes:
> I think that something along the lines of a "light" REventLoop (i.e.
> just the loop management where modules can register their handlers,
> w/o the "demo" loops) would be very helpful. What makes me wonder is
> that even quite recent code again just replaces the REPL (simply never
> returns back while duplicating the functionality) or uses other
> tricks. So, are there plans to replace the current REPL soon?
> (preferably in 1.8 ;)). If not, what are the reasons?
The main reason is that we can't seem to get it right... It would be a
very welcome thing to have in R-2.0 (Planned: Apr.2004) in some form or
another. Or 1.8 if you can just send us the perfect solution by next
week, for all platforms, please ;) ;)
[I'm not quite sure what you're pointing to with the "quite recent
code" remark. Could you be more specific?]
One particular issue that has come up again recently is that people
want to run REPL loops on connections (e.g. sockets). With the current
implementation, we can't handle incomplete input, and the only easy
fix would be to buffer up and reparse from start of expression at
every end of line, as we currently do on std. input. We could (I
think) fairly easily have a parser that could continue across line
endings, but we can't multiplex two of them. I.e., receiving "c(" on a
socket blocks the command line, and/or having the "+" prompt on the
console stops the socket processing.
This appears inevitable as long as we use single-threading and use a
parser that works using a single C call. Changing either might make it
work - you could potentially replace yyparse() with a state-machine
manipulator (e.g. bison can be set to generate a set of parse tables),
but multithreading seems much more straightforward.
--
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-devel
mailing list