Dear R users!

Several languages like C# or VB allow one to create properties; typically
these are under 'get', 'set' tags. My question is this really, what are
similar or comparable strategies in R, and what might be preferred? I have a
couple of situations where I want a certain computation to belong to a
class, but I do not really want to seperate it out to a stand-alone
function.

Here are a couple of options I see possible in R, and if I use the last
described option (see option C below), is there a way to access the object
with something like in C# or C++ where one would probably use the 'this'
keyword or the 'me' keyword in VB from within the property?:

A) MyObject@Property is static and must be handled carefully if it depends
on other slots of the class. If one of the slots changes, then because this
slot is static (containing only the value), it will not change to reflect
the update.

B) MyObject@Property is deprecated, and special accessor functions are used.
The bio group seems to favor this option. So one would use:
Property(MyObject). The drawback I see with this is that there is no strong
relationship between Property and MyObject; they are not explicitly related
via a class structure, and in some way this defeats the point of class
structures.

C) Let MyObject@Property be a function, so in order to fetch the slot object
we would use MyObject@Property(); the question here is can I use something
like a 'this' keyword to access other slots of thr object without having to
pass the whole class as a parameter to this slot function, ie the
round-about, clumsy way would have to look like MyObject@Property(MyObject).
Ideally, the pseudo-code I have in mind might look like this for an object
with two slots (A and B)

Object@A = function() return(.this@B)


Thoughts and considerations would be very interesting.

-Tariq

	[[alternative HTML version deleted]]

