Vitalie S.
2009-Sep-11 14:02 UTC
[R] Modify functions in base packages (needed for completion for proto objects)
Hello everyone, I am trying to implement completion for proto objects. Proto extends environment in a hierarchical way. Thus completion should list all the names in all it's parent environments. For "normal" classes defining names.class would do the job, but completion for "environment" is hard coded in utils:::specialCompletions by means of base::ls(). As result defining names.proto does not work. I tried to make "ls" generic and to do something like: environment(ls.default) <- asNamespace('utils') environment(ls) <- asNamespace('utils') environment(ls.proto) <- asNamespace('utils') That does not work either. Is there a way to make utils:::specialCompletions use my "ls" instead of "base::ls"?? I know Deepayan Sarkar is working now on improving the completion system (potentially by introducing "completion" generic). That would definitely solve the problem. But for now, does a quick fix exist? Thanks a lot, Vitalie
Gabor Grothendieck
2009-Sep-11 14:07 UTC
[R] Modify functions in base packages (needed for completion for proto objects)
See ?assignInNamespace On Fri, Sep 11, 2009 at 10:02 AM, Vitalie S. <vitosmail at rambler.ru> wrote:> > Hello everyone, > > I am trying to implement completion for proto objects. Proto extends > environment in a hierarchical way. Thus completion should list all the names > in all it's parent environments. > > For "normal" classes defining names.class would do the job, but completion > for "environment" is ?hard coded in utils:::specialCompletions by means of > base::ls(). As result defining names.proto does not work. > > I tried to make "ls" generic and to do something like: > > environment(ls.default) <- asNamespace('utils') > environment(ls) <- asNamespace('utils') > environment(ls.proto) <- asNamespace('utils') > > That does not work either. > > Is there a way to make utils:::specialCompletions use my "ls" instead of > "base::ls"?? > > I know Deepayan Sarkar is working now on improving the completion system > (potentially by introducing "completion" generic). That would definitely > solve the problem. But for now, does a quick fix exist? > > Thanks a lot, > Vitalie > > ______________________________________________ > R-help at 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. >