[R-sig-Geo] C API for sp classes?

Tim Keitt tkeitt at mail.utexas.edu
Tue Mar 7 20:01:17 CET 2006


On Tue, 2006-03-07 at 17:39 +0000, Barry Rowlingson wrote:
> Tim Keitt wrote:
> 
> > That's a rather odd aspect of S methods 
> 
>   one of many :)
> 
>   I think this stems from the S3 way that what other languages call 
> "methods of objects", R has as global namespace functions. In Python for 
> example, the method name is tied to the object, so you do: foo.bar() 
> instead of bar(foo). S3 shoe-horned the OO paradigm into the existing 
> functional syntax instead of extending the syntax such that methods were 
> true properties of objects. S4 methods continue this (IMHO) poor design 
> choice, and then tries to tidy up by having 'namespaces' declared in 
> packages - but at least it has a more formal method for declaring 

I couldn't agree more. It seems namespaces in R confuse binding names to
namespaces with encapsulation (hiding symbols within packages). For
efficiency reasons, your forced to export all your public symbols into
the global namespace anyway. Ugh!

As you point out, it would be nice if classes defined namespaces so that
methods could be attached to the class as in C++ and Python. Of course
programming S/R would not be nearly so much fun if it didn't have so
many quirks... :-)

> methods instead of S3's reliance on <generic>.<class> naming scheme!

I do prefer S4 methods. On the other hand, I found they really slowed my
rate of programming. Several of my packaging projects (DBI.PgSQL) got
derailed while I came up to speed with S4 methods.

THK

> 
>   If I could transparently bind all the statistical and graphical 
> functionality of R with the Python language I'd be happy :)[1]
> 
> Barry
> 
> [1] Yeah, I know there are R-Python links but they're not quite 
> transparent enough....
-- 
Timothy H. Keitt
Assistant Professor
http://www.keittlab.org/
http://www.utexas.edu/directory/index.php?q=Keitt




More information about the R-sig-Geo mailing list