From deepayan at stat.wisc.edu  Fri Apr 23 16:14:40 2004
From: deepayan at stat.wisc.edu (Deepayan Sarkar)
Date: Fri Apr 23 16:14:31 2004
Subject: [Rd] trellis.device in .First (PR#6812)
In-Reply-To: <16520.53902.315687.116655@gargle.gargle.HOWL>
References: <Pine.LNX.4.44.0404230741440.1166-100000@gannet.stats>
	<Pine.LNX.4.44.0404230809390.1166-100000@gannet.stats>
	<16520.53902.315687.116655@gargle.gargle.HOWL>
Message-ID: <200404230914.41062.deepayan@stat.wisc.edu>

On Friday 23 April 2004 03:23, 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?), 

(yes, device is an argument to trellis.device that defaults to 
getOption("device"))

> 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}.

That sounds like a good argument to go with the second approach. Looks 
like I would need importFrom(utils, getFromNamespace) for that, right ?

I'll release an updated version over the weekend.

Deepayan


[Rd] trellis.device in .First (PR#6812)
Deepayan Sarkar