|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [OSSTEST PATCH 6/9] db_retry: Suppress an "exiting via last" warning
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.
> Related to https://rt.perl.org/Public/Bug/Display.html?id=29238 perhaps.
I don't think so, although there seems to be a fair amount of
confusion there.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |