On Wed, 2005-06-08 at 14:15 +0200, Thomas Petzoldt wrote:
...
Hello Ross,
I see that your question was related to S4, but I just noticed a
solution based on the R.oo package so I thought I would add a solution
based on the proto package too. We had similar problems several times
ago and (to
On Wed, 2005-06-08 at 09:13 +0200, Uwe Ligges wrote:
[extensive deletions. Discussion concerned my desire to have a function change
the value
of an object in a way that had effects outside of the function, without
returning the object.]
You have to think about scoping rules and it
will be
Ross Boylan wrote:
I believe your example assumes that foo is updating the outer a by
cheating and directly modifying enclosing environments. (I figure it
also needs to get the name of its actual argument to do this, which
would also involve slightly dirty tricks.) This does seem to be the
On 6/9/2005 3:04 PM, Ross Boylan wrote:
On Wed, 2005-06-08 at 09:13 +0200, Uwe Ligges wrote:
[extensive deletions. Discussion concerned my desire to have a function change
the value
of an object in a way that had effects outside of the function, without
returning the object.]
You have to
Ross Boylan wrote:
The paper also notes that call-by-value vs call-by-reference, which is
the root of the slot update problem, is really orthogonal to the
FOOP/COOP distinction. It's easy to imagine FOOP with
call-by-reference. R.oo uses references.
Yes, it can be found on
Ross Boylan wrote:
On Tue, 2005-06-07 at 08:36 +0200, Uwe Ligges wrote:
Ross Boylan wrote:
On Sat, Jun 04, 2005 at 07:08:56PM +0200, Martin Maechler wrote:
Ross nextPath - function(pm){ #pm is a CompletePathMaker
Ross[EMAIL PROTECTED] - [EMAIL PROTECTED](1)
Ross [etc]
If your
Ross Boylan wrote:
I defined an S4 class with a slot i. Then I wrote a regular function
that attempted to increment i.
[... details deleted ...]
What do I need to do to update slot values?
Here are some possibly relevant code fragments
setClass(CompletePathMaker,
Ross Boylan wrote:
On Sat, Jun 04, 2005 at 07:08:56PM +0200, Martin Maechler wrote:
Ross nextPath - function(pm){ #pm is a CompletePathMaker
Ross[EMAIL PROTECTED] - [EMAIL PROTECTED](1)
Ross [etc]
If your nextPath function has 'pm' as its last statement it
will return the
On Mon, 2005-06-06 at 14:15 -0700, Berton Gunter wrote:
I'm puzzled:
It looks as if instances of class objects are best thought of as
immutable once created.
what then is setReplaceMethod() for?
assignment operators do the whole object replacement behind the scenes,
at least
On Tue, 2005-06-07 at 08:36 +0200, Uwe Ligges wrote:
Ross Boylan wrote:
On Sat, Jun 04, 2005 at 07:08:56PM +0200, Martin Maechler wrote:
Ross nextPath - function(pm){ #pm is a CompletePathMaker
Ross[EMAIL PROTECTED] - [EMAIL PROTECTED](1)
Ross [etc]
If your nextPath
Second, in my experiments I couldn't get setReplacementMethod to work:
bumpIndex- - function(pm, value) {
[EMAIL PROTECTED] - [EMAIL PROTECTED](value)
pm
}
# I get an error without the next function definition
bumpIndex - function(pm) [EMAIL PROTECTED]
setReplaceMethod(bumpIndex,
Berton Gunter wrote:
Second, in my experiments I couldn't get setReplacementMethod to work:
bumpIndex- - function(pm, value) {
[EMAIL PROTECTED] - [EMAIL PROTECTED](value)
pm
}
# I get an error without the next function definition
bumpIndex - function(pm) [EMAIL PROTECTED]
On Tue, 2005-06-07 at 13:49 -0700, Berton Gunter wrote:
Second, in my experiments I couldn't get setReplacementMethod to work:
bumpIndex- - function(pm, value) {
[EMAIL PROTECTED] - [EMAIL PROTECTED](value)
pm
}
# I get an error without the next function definition
On Sat, Jun 04, 2005 at 07:08:56PM +0200, Martin Maechler wrote:
Ross nextPath - function(pm){ #pm is a CompletePathMaker
Ross[EMAIL PROTECTED] - [EMAIL PROTECTED](1)
Ross [etc]
If your nextPath function has 'pm' as its last statement it
will return the updated object,
Ross == Ross Boylan [EMAIL PROTECTED]
on Fri, 03 Jun 2005 17:04:08 -0700 writes:
Ross I defined an S4 class with a slot i. Then I wrote a regular function
Ross that attempted to increment i.
Ross This didn't work, apparently because of the general rule that a
function
I defined an S4 class with a slot i. Then I wrote a regular function
that attempted to increment i.
This didn't work, apparently because of the general rule that a function
can't change the values of its arguments outside the function. I gather
there are ways around it, but the Green book
16 matches
Mail list logo