From byron.ellis at gmail.com  Thu Aug 16 22:34:55 2007
From: byron.ellis at gmail.com (Byron Ellis)
Date: Thu, 16 Aug 2007 13:34:55 -0700
Subject: [Rd] methods and try() [R-devel]
In-Reply-To: <Pine.LNX.4.64.0708161525100.2836@itasca2.wildberry.org>
References: <7098abec0708152232s6d9fbb2ewb76cfa2cd4d7b1b2@mail.gmail.com>
	<Pine.LNX.4.64.0708160742020.2550@itasca2.wildberry.org>
	<7098abec0708161253l4b437f37l380c529d1fd4c558@mail.gmail.com>
	<Pine.LNX.4.64.0708161525100.2836@itasca2.wildberry.org>
Message-ID: <7098abec0708161334q269d41b0ob4d2398d6660c1b3@mail.gmail.com>

On 8/16/07, Luke Tierney <luke at stat.uiowa.edu> wrote:
>
> There sae, at 2.5.0 I believe.  At that point try was reimplemented in
> terms of tryCatch.  That may have uncovered a bug in our code or
> yours, but without a reproducible example it's hard to say more.

An indeed, I believe I've got one. Turns out it didn't solve my
problem though. So, imagine we have a method (with a new generic).
Say,

setGeneric("glue",function(a,b) standardGeneric("glue"))
setMethod("glue",signature("character","character"),function(a,b) {
	paste(a,b,sep="")
})

Trying the code:

> glue("A","B")
[1] "AB"
> glue("A",B)
Error: object "B" not found
Error in glue("A", B) :
  error in evaluating the argument 'b' in selecting a method for function 'glue'

Good. Works as expected (there's no B in the environment). However,
I'd expect try to work...

>  try(glue("A",B))
Error: no function to return from, jumping to top level
Error in glue("A", B) :
  error in evaluating the argument 'b' in selecting a method for function 'glue'

with silent=TRUE the "jumping to top level" is not caught and causes
scripts to bail out.

Hopefully that helps?


>
> Best,
>
> luke
>
>
> >
> >>
> >> Best,
> >>
> >> luke
> >>
> >>
> >> --
> >> Luke Tierney
> >> Chair, Statistics and Actuarial Science
> >> Ralph E. Wareham Professor of Mathematical Sciences
> >> University of Iowa                  Phone:             319-335-3386
> >> Department of Statistics and        Fax:               319-335-3017
> >>     Actuarial Science
> >> 241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
> >> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
> >>
> >
> >
> >
>
> --
> Luke Tierney
> Chair, Statistics and Actuarial Science
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa                  Phone:             319-335-3386
> Department of Statistics and        Fax:               319-335-3017
>     Actuarial Science
> 241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
>


-- 
Byron Ellis (byron.ellis at gmail.com)
"Oook" -- The Librarian



[Rd] methods and try() [R-devel]
Byron Ellis