swirlexp/swirlfancy — pull request #6 by WilCrofter (2013-12-05 15:24:24+00:00)
Title: used !exists("mod", e, inherits=FALSE) to detect need to initialize

The default is inherits=TRUE which means that if "mod" does not exist in e, R looks in the enclosing environment. Thus, if you happen to have a variable named "mod" around, initialization fails.

My original fix, before actually reading the docs for exists, involved `identical(e$expr, quote(hi("testMod"))`. As was noted by a colleague, such hard-coding has disadvantages. For instance if hi is called with a vector argument:

> `hi( c("newClass", "testMod") )`,

as it might be if newClass were meant to override testMod's initSwirl and saveProgress methods, initialization would again fail.