Best way to implement optional functions?
I'm relieved to read that this issue is becoming more visible. In my own work on optimizers, I've been finding it awkward to provide a clean solution to allowing users to run e.g., optimx, when some optimizers are not installed. Unfortunately, I've not found what I consider to be a solution with any elegance. JN
On 15-10-23 06:00 AM, r-devel-request at r-project.org wrote:
Message: 8 Date: Thu, 22 Oct 2015 15:55:01 -0400 From: Duncan Murdoch <murdoch.duncan at gmail.com> To: "R-devel at r-project.org" <r-devel at r-project.org> Subject: [Rd] Best way to implement optional functions? Message-ID: <56293F15.80509 at gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed I'm planning on adding some new WebGL functionality to the rgl package, but it will pull in a very large number of dependencies. Since many people won't need it, I'd like to make the new parts optional. The general idea I'm thinking of is to put the new stuff into a separate package, and have rgl "Suggest" it. But I'm not sure whether these functions should only be available in the new package (so users would have to attach it to use them), or whether they should be in rgl, but fail if the new package is not available for loading. Can people suggest other packages that solve this kind of problem in a good way? Duncan Murdoch