From murdoch.duncan at gmail.com  Thu Sep 10 15:18:49 2015
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Thu, 10 Sep 2015 09:18:49 -0400
Subject: [Rd] Using IDs to suppress specific messages and warnings
In-Reply-To: <CAPp_+=f5bsevd=Cpw5jTm2+H6qjES_qykMkVtBo4FPvC3+RHRA@mail.gmail.com>
References: <CAPp_+=dnGknY1_SzsMw48q89LCBvavrceUZj4hyowWt8YAOseg@mail.gmail.com>
	<alpine.DEB.2.10.1509100642530.2561@luke-Latitude>
	<CAPp_+=f5bsevd=Cpw5jTm2+H6qjES_qykMkVtBo4FPvC3+RHRA@mail.gmail.com>
Message-ID: <55F18339.9090400@gmail.com>

On 10/09/2015 9:03 AM, Richard Cotton wrote:
> Thanks Luke,
> 
> On 10 September 2015 at 14:47,  <luke-tierney at 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"
> 
> 
>> 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
> 
> Who is the best person to ask/cajole to start getting this implemented?

I think that if you put together a proposal that looks easy to implement
and maintain, and volunteered (or recruited volunteers) to do most of
the work, then it would get done.  I don't think either of the posted
hierarchies would be acceptable, though, because they'd require anyone
who was writing new code to learn them.

Currently if I want to put in a warning, it's easy:  I just call
warning().  If you make it take an extra 5 seconds to add something that
makes the warning more useful, I'd do it.  If it takes 10 minutes of
reading through voluminous documentation, I wouldn't.

Duncan Murdoch



[Rd] Using IDs to suppress specific messages and warnings
Duncan Murdoch