[Rd] methods and try() [R-devel]
Byron Ellis
byron.ellis at gmail.com
Thu Aug 16 22:34:55 CEST 2007
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
More information about the R-devel
mailing list