From: Noah Easterly Date: 2006-10-02T22:30:08+09:00 Subject: Re: Is object[x](y,z) always invalid? Yeah, it would be pretty easy to redefine method_missing to forward calls to r.symbol(*args) to r[:symbol, *args], or whatever internal structure you have. Then your end users would have a clean syntax, and you wouldn't have to do a lot of work. Timothy Goddard wrote: > You could still use the r.sum(1,2) for 99% of your method calls. The > use of square brackets rather than round ones would hardly matter for > the remaining few, which already look odd! > > Alex Gutteridge wrote: > > On 1 Oct 2006, at 23:00, Kalman Noel wrote: > > > > > Alex Gutteridge: > > >> foo[x](y,z) > > >> foo[x][y,z] > > >> foo[x].call(y,z) > > > > > > Would it be a problem to write foo(x,y,z) or foo[x,y,z]? > > > > > > Kalman > > > > That is another option I had considered. However, in the library in > > question 'foo' represents a running R interpreter, 'x' represents an > > R function and 'y' and 'z' represent arguments to that function. So I > > would like to keep 'x' and 'y,z' visually separate as much as > > possible. So, while it is a little extra typing, I prefer: r > > ['sum'].call(1,2) over r('sum',1,2). In this case it would also be > > possible to write the preferred form: r.sum(1,2) but as I mentioned, > > this is not possible for some strangely named R functions such as '$' > > or '[['. > > > > Dr Alex Gutteridge > > Post-Doctoral Researcher > > > > Bioinformatics Center > > Institute for Chemical Research > > Kyoto University > > Gokasho, Uji, Kyoto 611-0011 > > Japan