[R] How to Describe R to Finance People

Tony Plate tplate at blackmesacapital.com
Tue Jun 8 18:49:09 CEST 2004


At Monday 07:58 PM 6/7/2004, Richard A. O'Keefe wrote:
>[snip]
>There are three perspectives on programming languages like the S/R family:
>(1) The programming language perspective.
>     I am sorry to tell you that the only excuse for R is S.
>     R is *weird*.  It combines error-prone C-like syntax with data structures
>     that are APL-like but not sufficiently* APL-like to have behaviour that
>     is easy to reason about.  The scope rules (certainly the scope rules for
>     S) were obviously designed by someone who had a fanatical hatred of
>     compilers and wanted to ensure that the language could never be usefully
>     compiled.

What in particular about the scope rules for S makes it tough for 
compilers?  The scope for ordinary variables seems pretty straightforward 
-- either local or in one of several global locations.  (Or are you 
referring to the feature of the get() function that it can access variables 
in any frame?)


>   Thanks to 'with' the R scope rules are little better.  The
>     fact that (object)$name returns NULL instead of reporting an error when
>     the object doesn't _have_ a $name property means that errors can be
>     delayed to the point where debugging is harder than it needs to be.

Yup, that's why I proposed (and provided an implementation) of an 
alternative "$$" operator that did report an error when object$$name didn't 
have a "name" component (and also didn't allow abbreviation), but there was 
no interest shown in incorporating this into R.

-- Tony Plate




More information about the R-help mailing list