Re: [Rd] methods and try() [R-devel]

From: Byron Ellis <byron.ellis_at_gmail.com>
Date: Thu, 16 Aug 2007 13:34:55 -0700

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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 16 Aug 2007 - 20:54:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 16 Aug 2007 - 23:38:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.