develooper Front page | perl.perl5.porters | Postings from June 2021

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
David Nicol
June 18, 2021 17:36
Re: RFC 0004 - defer {} syntax
Message ID:
very true. The rest of the single exit point pattern is having some
discipline about not exiting except via it.

>>   Whereas the defer "enqueues a block of code for later execution, when
>> control leaves its surrounding scope for whatever reason", so as long as
>> the defer statement is reached, the block will eventually run.  (Well,
>> untimely program termination will prevent it, I guess.)
> Yes, the primary usecase for scope guards is to run regardless of whether
> the scope is normally exited. Abnormal scope exits include exceptions, loop
> control flow, and returning from a subroutine, among more esoteric options.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About