On 01/02/2016 4:26 AM, Martin Maechler wrote:
"BH" == Bryan Hanson <han...@depauw.edu>
     on Sun, 31 Jan 2016 09:50:46 -0500 writes:

     BH> I think the 2nd option will be more palatable to
     BH> inexperienced users, but both do state the important
     BH> detail.  Bryan

     >> On Jan 30, 2016, at 4:11 PM, Duncan Murdoch <murdoch.dun...@gmail.com> 
wrote:
     >>
     >> On OSX and Linux, the rgl package currently requires X11
     >> libs to be available for linking.  Recent versions of OSX
     >> don't include them by default, so I'd like rgl to fail
     >> nicely.
     >>
     >> Ideally, it will load a library that doesn't need to link
     >> to the X11 libs but will still allow WebGL code to work,
     >> but that's complicated, so I'd like a stopgap.
     >>
     >> I can detect that the failure is about to happen, and
     >> call stop() in the .onLoad hook, but that gives an ugly
     >> message:
     >>
     >> > library(rgl)
     >> Error : .onLoad failed in loadNamespace() for 'rgl', details:
     >> call: NULL
     >> error: X11 not found; XQuartz (from www.xquartz.org) is required to run 
rgl.
     >> Error: package or namespace load failed for ‘rgl’

I agree that the error message is a bit messy or even ugly,
however, other than Bryan, I would want  library(.)  to signal
an error when it cannot provide a working package, loaded and
attached to search().

Other functions, such as  require(.)  do rely on this behavior of library(.),
e.g., the much used idiom

   if(require(<some package>)) {
       ....
       ....
       ....
   }

needs library() to signal an error on  non-success.

Yes, that's a good point. That's what the version on R-forge currently does.

Duncan Murdoch


Martin

     >> Alternatively, I can just give a warning and not attempt to load the 
rgl lib:
     >>
     >> > library(rgl)
     >> Warning message:
     >> X11 not found; XQuartz (from www.xquartz.org) is required to run rgl.
     >>
     >> rgl is now loaded, but it doesn't work; just about any function call 
will give an error, e.g.
     >>
     >> > plot3d(1,2,3)
     >> Error in rgl.cur() : object 'rgl_dev_getcurrent' not found
     >>
     >> Do people have opinions about this?
     >>
     >> One comparable package is RGtk2:  if Gtk2 isn't install, it offers to 
install it.  I could probably do that for XQuartz.  If the user says no, RGtk2 gives 
really ugly error messages.  rgl can work without XQuartz, but as I already 
mentioned, making this work is complicated, so I'd like something simple for now.
     >>
     >> Duncan Murdoch
     >>
     >> ______________________________________________
     >> R-devel@r-project.org mailing list
     >> https://stat.ethz.ch/mailman/listinfo/r-devel

     > ______________________________________________
     > R-devel@r-project.org mailing list
     > https://stat.ethz.ch/mailman/listinfo/r-devel


______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to