From: Ian Jackson Subject: Re: [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning Date: Thu, 17 Dec 2015 17:48:53 +0000 Message-ID: <22130.62853.68527.604758@mariner.uk.xensource.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> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1a9cfi-000357-64 for xen-devel@lists.xenproject.org; Thu, 17 Dec 2015 17:48:58 +0000 In-Reply-To: <1450373473.4053.147.camel@citrix.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 Campbell Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [OSSTEST PATCH 6/9] db_retry: Suppress an "exitin= g 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. > Related to=A0https://rt.perl.org/Public/Bug/Display.html?id=3D29238=A0per= haps. I don't think so, although there seems to be a fair amount of confusion there. Ian.