On Mon, 26 Apr 2004, Paul Murrell wrote:
Hi
Martin Maechler wrote:
"BDR" == Prof Brian Ripley <ripley@stats.ox.ac.uk>
on Fri, 23 Apr 2004 08:21:34 +0100 (BST) writes:
<........>
BDR> It is a matter for discussion (with the lattice
BDR> maintainer) whether trellis.device should help you out
BDR> here by importing the devices from package graphics. I
BDR> think adding (conditionalized on the platform)
BDR> importFrom(graphics, windows, postscript, pdf, pictex,
BDR> win.metafile, win.print, png, jpeg, bmp, xfig, bitmap)
BDR> to its NAMESPACE might be worth considering.
BDR> Alternatively, device.call <- get(device) could be put
BDR> in a try call, followed by a try on
BDR> getFromNamespace("graphics", device).
That's a very good idea, I'd support quite a bit.
I think I would go with the alternative approach
(where you probably meant to say device <- getOption("device") first?),
since the importFrom(..) approach leeds to a somewhat tedious maintenance
effort to keep up the list of available devices for the different platforms
(For MacOS X one has to include quartz() only in the situations
where it's available) where as Deepayan (the lattice
maintainer) could rely on getOption("device") to be ok
{and as you proposed would be on guard using try() or its newer siblings}.
I probably should have thought of this sooner, but anyway ...
Perhaps a better solution would be to split out another package called
"devices". Then both "graphics" and "grid" could require "devices" (so
whenever you go to do any graphics you are guaranteed access to the
default devices).
I am not sure it is better, but it is not something we can do for a few
months (that is, not in a patchlevel release).