[R] Two names of a function

Göran Broström gb at stat.umu.se
Wed May 14 10:29:15 CEST 2003


On Wed, 14 May 2003, Prof Brian Ripley wrote:

> On Wed, 14 May 2003, Göran Broström wrote:
> 
> > Is it possible to let a function be known under two names without having
> > two identical copies of the function body? 
> 
> Well, that's what .Alias did (have one copy), and it has been removed.  
> There's nothing to stop you writing a version of .Alias via .Call, except
> there were good reasons to remove it.  Given that, perhaps you should ask
> what how to do what you really want to do (the top-level task that
> prompted this question).

The reason is backward compability; I'm rewriting an R package, changing a 
few function names (for good reasons). I may better use the way 'optimise' 
and 'optimize' do it; two identical wrappers to a common function.

Thanks,

Göran
 
> 
> I don't think you can even know if there are two copies of the function 
> body: there can be potential copies of R objects which are shared until 
> one is altered.  I would have to read the internal code very carefully to 
> find out if e.g. body<- made an actual copy.
> 
>




More information about the R-help mailing list