On Thu, 10 Sep 2015, Richard Cotton wrote:

Thanks Luke,

On 10 September 2015 at 14:47,  <luke-tier...@uiowa.edu> wrote:
Conditions have classes and the condition system is designed around
the idea that classes would be used for this sort of thing. That is
already how tryCatch and withCallingHandlers discriminate the
conditions to handle.

That makes sense.  Though with my sqrt example, it's just a plain
simpleWarning, which doesn't give you the opportunity to do special
handling.

tryCatch(sqrt(-1), warning = function(w) class(w))
## [1] "simpleWarning" "warning"       "condition"

Obviously, that is what happens now since e don't yet have a developed
hierarchy of classes. This, and most other internally generated
warnings/errors, would need to change to more specific classes of
warnings/errors once the hierarchy is developed.

Designing and implementing a condition class hierarchy to support this
is indeed the hard/tedious part.

There are precedents from other languages that could be used as a
template.  For example, .NET and Java both have very well defined
exception hierarchies that could serve as a starting point.

https://msdn.microsoft.com/en-us/library/z4c5tckx%28v=vs.110%29.aspx
https://docs.oracle.com/javase/7/docs/api/java/lang/package-tree.html

The R condition system is based on the one in common lisp, which is
quite bit richer than Java's mechanism. Common Lisp's hierarchy would
be the best starting point, though ideas from the hierarchy in Java
could be useful as well.

Who is the best person to ask/cajole to start getting this implemented?

I't been on my long todo list for a long time, but I don't expect to
have the time to do it myself anytime soon.  If someone else want to
put in the work I am willing to work with them.

Best,

luke

--
Luke Tierney
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-tier...@uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to