Dear list,

This probably makes perfect sense from the language designers' 
perspective, but at least for me this was/is quite an interesting and 
unexpected behavior which I thought might be worth sharing:

The default value of argument |where|in function |getClasses()|seems to 
vary depending on whether |getClasses()|is called inside a *standard R 
function*or a *formal S4 method*. It is controlled by 
|.externalCallerEnv()|, which seems to be "vulnerable" to /lazy 
evaluation/and/or an "altered" /lexical scoping/structure (possible 
introduced by the definition of a formals S4 method?) and thus causes 
the variation**.

I found it quite hard to understand what's exactly going on as you need 
to manually debug `getClasses()` in order to find out what the default 
value of `where` (controlled by `|.externalCallerEnv()`) actually is in 
the various settings|. But that of course might as well be just me ;-)

For those interested, I tried to illustrate the behavior in this SO post:
http://stackoverflow.com/questions/12166645/ambiguous-variation-of-default-environment-in-getclasses-standard-function/12174390#12174390

Best regards,
Janko Thyson



	[[alternative HTML version deleted]]

