Skip to content
Prev 34723 / 398502 Next

Formal definitions of R-language.

some comments. I am still learning S/R so please let me know if I am
missing something.
"M.Kondrin" wrote:
R is object oriented in the sense that the basic entities of the
language (data elements, language elements etc.) are complex entities
with type and defined behavior (objects). it has inheritance,
polymorphism, operator overloading etc. you can define constructors for
objects, but as far as I know no destructors (you can define clean up
routines on libraries though).

it has has elements of being a functional language like the fact that
programs are composed of expressions that are turned into function
objects that get evaluated. it also supports lambda expressions. it is
not a pure functional language because functions can and do have side
effects, it has persistent state and assignments, and it has flow of
control statements. also, recursion, as far as I know, is inefficient in
S/R. which tend to discourage purely functional programming.
weak typing. variables are not typed and keep type information once
constructed. conversion between types is often automatic or can be
programmed to be so, hence operations on disparate types can often be
carried out.
it is dynamically typed. objects carry and supply type information at
run time. types (as well as behavior) can (only) be defined at run time.
the S-evaluator has to start first, it then constructs class and
function definitions in the run-time environment. object type can be
changed, modified and augmented at run time, at least with old style
classes, (can you add or remove slots in the new style classes?).
uses lazy evaluation of expressions. expressions are constructed by the
S-evaluator, but not evaluated until needed.
No garbage collector. uses reference counting to discard objects that
are no longer needed.