Skip to content
Prev 9167 / 398502 Next

Object orientation?

"Yves Gauvreau" <cyg at sympatico.ca> writes:
Generally, that's when people try to turn R (or S) into a macro
language. There could be situations where it's the right thing...

However, for this situation, how about something like

class(MyO) <- "foo"
"$<-.foo" <- function(x, name, value)
{
   if ( !is.null(x$let) )
	x$let(PropertyName=name, value)
   else
	x[[name]] <- value
}

MyO$ThisProperty <- ThisValue

(but wouldn't x$let or MyO.let need to have some way of figuring out
which object is its owner??)