[R-gui] Re: [R] Feedback about SciViews?

Duncan Temple Lang duncan at research.bell-labs.com
Wed Apr 30 10:19:16 MEST 2003


The embedded.html file on developer.r-project.org has a date of August
2000 and it is an RFC rather than part of the R-extensions manual.  It
is out of date and I need to put something into the R extensions
manual to give the "best" approach for handling R errors at the C
level. Ironically, I was chatting with David James on Monday about
this and noted that it wasn't in the extensions manual.

R_jump_now was a left over because of the way the header files did not
export low-level data structures needed for error handling in C.
Luke and I have provided the R_tryEval() routine which one can use
to evaluate an R expression and guarantee returning to that point
in the C code whether there was an error or not.

While it would be better if it was documented in a manual, it
currently isn't. However, many packages illustrate its use.  For
example, almost all of the inter-system interface packages in
Omegahat.  Since there are relatively few people working with
embedding R, documenting them hasn't been impertaive. I find it works
better to have people ask questions about how to do things or why they
are they way they are and then build a FAQ and then documentation from
that rather than just accepting they are this way.
 

Luke, Robert, and I discussed S-level exceptions many years ago and
they are still very much on the todo list. (I raise the issue probably
once every 2 or 3 weeks.)  Regular/exiting exceptions as in Java, C++, ...
are relatively straight forward (especially _now_ that we a more formal
class system (S4).)  Robert and Luke have plans for calling exceptions.


 D.


Zed Shaw wrote:
> Hi Byron,
> 
> With regard to your comments on exception handling, I say I have to 
> agree, but I'm not quite sure where you got that I was critiquing R's 
> exception handling.  It's no better or worse than others, although I 
> agree that try/catch would be nice.  Actually, I'm using try() to get 
> around my real complaint:  jump_now handling.
> 
> Read the "Handling Errors" section of:
> 
> http://developer.r-project.org/embedded.html
> 
> For details on what is wrong.  Now, they recommend that you actually 
> create a function that overrides the jump_now found in the libR.so 
> file.  The problem with that is when you are on other platforms (like, 
> Mac OSX) the libR.so jump_now overrides the one you write.  If they 
> created a global variable like "R_JumpNowFunc" which you could set to 
> your own jump_now handler, then the problem would go away.
> 
> I went into fits for about a week trying just about everything I could 
> to get my version of jump_now to work.  Eventually I just backed out of 
> it and now wrap everything in a try({}) call to keep R from crashing.  
> This is what I mean when I complain about how jumps are used to 
> maintain the event loop.
> 
> Just a quick clarification, otherwise I pretty much agree with what you 
> say.  The main things I'd like added to R are too long to mention, and 
> I doubt anyone who could make the changes would care.
> 
> Zed A. Shaw
> http://www.zedshaw.com/
> 
> 
> On Tuesday, April 29, 2003, at 07:32 PM, Byron Ellis wrote:
> 
> >
> > Well the pty thing I'll give you---irritating as hell---but as for R's 
> > exception handling and its ease of repair, your statements somewhat 
> > disingenuous. R's exception handling mechanism is simply How It is 
> > Done in C. Go look at the Python source code sometime, what do you 
> > find? That's right. setjmp()/longjmp() for exception handling. Just 
> > like R. Just like Objective-C and AFAIK Perl as well.
> 
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-gui

-- 
_______________________________________________________________

Duncan Temple Lang                duncan at research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       
         http://cm.bell-labs.com/stat/duncan



More information about the R-SIG-GUI mailing list