On Thu, Oct 2, 2008 at 11:26 AM, Alexy Khrabrov <[EMAIL PROTECTED]> wrote: > Yes, I could prefix everything with taskN$, but that's boring! Can I now > attach and detach tasks to have one prefix-less, since they look like > dataframes?
Read the proto vignette and other info to get a better understanding of the prototype model of object oriented programming. See the home page at http://r-proto.googlecode.com Certainly one can attach and detach objects although its not clear whether that is desirable or its effect on delegation/inheritance (if you use those facilities). If you are going to use them simply as modules then it would likely be ok: attach(task1) var detach(task1) > What does proto buy us? What do namespaces buy us? Namespaces are environments and so are proto objects. proto objects give you the facitilites of object oriented programming including delegation (like inheritance) although based on your description you only intend to use them as modules (but if you think about your modules as objects the OO approach might further simplify and organize your project). > > To respond to Uwe here as well, I want dynamic task switching and *also* an > ability to load and save task from their workspaces into their namespaces in > the same R session. > > Cheers, > Alexy > > On Oct 2, 2008, at 11:19 AM, Gabor Grothendieck wrote: > >> You could have an environment for each task and place your objects for >> each task in its environment. >> >> Note that this is getting close to object oriented ideas where each >> enviroment/task >> is an object containing your R variables and methods and the proto package >> can be used to facilitate that: >> >> library(proto) >> task1 <- proto(var = 0, addx = function(this, x) this$var <- this$var + x) >> task1$var # 0 >> task1$addx(3) >> task1$var # 3 >> >> On Thu, Oct 2, 2008 at 11:03 AM, Alexy Khrabrov <[EMAIL PROTECTED]> >> wrote: >>> >>> I'd like to control my namespace thoroughly, separated by task. Is there >>> a >>> way, in R session, to introduce namespaces for tasks dynamically and >>> switch >>> them as needed? Or, is there a combination of load/save workspace steps >>> which can facilitate this? >>> >>> Cheers, >>> Alexy >>> >>> ______________________________________________ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.