From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning Date: Thu, 17 Dec 2015 18:10:01 +0000 Message-ID: <1450375801.1617.86.camel@citrix.com> References: <1450371968-27997-1-git-send-email-ian.jackson@eu.citrix.com> <1450371968-27997-6-git-send-email-ian.jackson@eu.citrix.com> <1450373473.4053.147.camel@citrix.com> <22130.62853.68527.604758@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9d0C-0004p0-7E for xen-devel@lists.xenproject.org; Thu, 17 Dec 2015 18:10:08 +0000 In-Reply-To: <22130.62853.68527.604758@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, 2015-12-17 at 17:48 +0000, Ian Jackson wrote: > Ian Campbell writes ("Re: [OSSTEST PATCH 6/9] db_retry: Suppress an > "exiting via last" warning"): > > On Thu, 2015-12-17 at 17:06 +0000, Ian Jackson wrote: > > > This warning appears when db_retry_abort is used, since 2b069b6c > > > "Database locking: Perl: Retry all deadlocks in PostgreSQL". > > = > > Is the reason for not turning this into a return related to the > fact this > > is within an eval, not a proper sub? But then I'm not really sure > why it is > > warning (I suppose eval has some sub like properties?). > = > I think it's a warning because eval does not trap `last's (nor > `return's). This means that if you think `eval' can be used to make > try-finally, you will be disappointed. > = > (Unlike, in Tcl, say, where `break' and `continue' and indeed = > `return > are implemented as exceptions.) > = > Why would `return' be better ? It would still generate the same > warning. Leaving the loop via `last' seems less heavyweight than > using `return' and less likely to produce bugs in future patches whose > authors don't spot the non-local exit. I think I'm probably confused about the scope of the eval vs {last,return} etc. In any case, that's no reason to block this patch AFAICT: Acked-by: Ian Campbell Ian. > = > > Related to = > https://rt.perl.org/Public/Bug/Display.html?id=3D29238=A0perhaps. > = > I don't think so, although there seems to be a fair amount of > confusion there. > = > Ian.