[R] Modify functions in base packages (needed for completion for proto objects)

Vitalie S. vitosmail at rambler.ru
Fri Sep 11 16:02:18 CEST 2009


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




More information about the R-help mailing list