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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
June 16, 2021 23:20
Re: RFC 0004 - defer {} syntax
Message ID:
"Paul \"LeoNerd\" Evans" <> wrote:
:Here's an RFC formalization of my currently-open github feature issue:
:which was itself an issue tracking the previous mailing list

:As well as being more convenient for users, it would help decouple Perl
:core's object behaviours, like `DESTROY`, from this task. If less code
:relies on DESTROY, it may one day be possible to change the way that
:part of the code works, without worrying so much about code that relies
:on it breaking.

At least the second sentence here feels like a red herring. I'd be very
happy to see defer in the language, but I cannot envisage its existence
significantly reducing the need to retain DESTROY behaviour within any
relevant timescale.

:Another rejected idea is that of conditional enqueue:
:  defer if (EXPR) { BLOCK }

Given the (snipped) reference to symmetry with the behaviour of local,
I would be hopeful that you could get the same effect with:
  defer BLOCK if EXPR;
just as we can get conditional localization (something of which I make
heavy use in recursive code), eg:
  local @hash{@keys} = @values if $localize;


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