Skip to content
Prev 285526 / 398502 Next

sequencing environments

On 12-02-15 11:58 PM, Ben quant wrote:
I'd advise thinking really carefully about this, because I think it 
indicates you've got a mental model of R internals that isn't a good 
match to what's really going on.  The kinds of things you might think about:

Would you find it just as strange that you can't easily get a list of 
all character vectors?  Environments aren't really more special than 
other objects.

If you think it's strange that you can't get a list of all character 
vectors, then consider that many of them aren't bound to names, so 
they'll have a C-level pointer to identify them, but they'll be hard to 
get to from within R.

The memory manager has a list of all objects and it goes through this 
list during garbage collection, but that's not something that user-level 
code should be able to do (except possibly debugging code).
I would recommend that you avoid inventing another object system.  R 
currently has too many of those, and it means that lots of good code is 
unreadable by people who use a different one than you chose.

Gabor gave a list of existing systems based on environments; besides 
those you should consider the S4 system without reference classes (from 
the methods package).

I don't know any of them well enough to tell you how to choose, but I 
think if you put together prototypes of your project you'll run into 
problems with any of them, and a big part of your choice should be to 
see how easy it is to resolve those problems:  Do you get good help from 
the documentation?  Do you get good help on the mailing lists or 
Stackoverflow?


Duncan Murdoch