[Roxygen-devel] Parsing roxgen blocks

Vitalie Spinu spinuvit at gmail.com
Wed Aug 29 20:25:14 CEST 2012


  >> Hadley Wickham <hadley at rice.edu>
  >> on Wed, 29 Aug 2012 12:16:15 -0500 wrote:

  > I was thinking more that instead of

  > roxy_env_inspector <- new.env(parent = emptyenv())
  > roxy_env_inspector[["S3"]] <- ...
  > roxy_env_inspector[["S4"]] <- ...

  > you'd do

  > setClass("RoxyInspector")
  > setClass("S4RoxyInspector", contains = c("RoxyInspector"))
  > setMethod("inspector", signature("S4RoxyInspector"), ...)
  > setClass("S3RoxyInspector", contains = c("RoxyInspector"))
  > setMethod("inspector", signature("S3RoxyInspector"), ...)

  > and then retrieve all the inspectors by using a S4 introspection
  > function to get all children of RoxyInspector.

:D

I see. Use S4 for a storage. Well, a bit to fancy for me ;).

As an alternative you can just provide a function
roxy_register_detector(fun) which would just store fun in an environment
in roxy namespace. Simple, and everyone understands what happens.


  >> Whatever the textual representation by which object X is generated X <-
  >> new(..), or X <- X.constructor(), or createObjectX(), or X <- eval(...)
  >> will always have the same result.  It is much easier for the end user,
  >> who is not forced to use a specific declaration for roxygen to work. All
  >> what matters is the end object(s) which the code generate.

  > Ok, agreed.  If you can do it, I'll happy include the code :)

Yep, hopefully this weekend.

     Vitalie.


More information about the Roxygen-devel mailing list