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

Re: RFC 0004 - defer {} syntax

Thread Previous | Thread Next
From:
=?UTF-8?Q?Branislav_Zahradn=C3=ADk?=
Date:
June 23, 2021 04:14
Subject:
Re: RFC 0004 - defer {} syntax
Message ID:
CAB=rbO=p8c=gnPS8nJMH327OCK+zeD_fg=5GChMsWWA6TPRnLw@mail.gmail.com
On Tue, 22 Jun 2021 at 20:16, David Nicol <davidnicol@gmail.com> wrote:

>
> how about some kind of way to inject coderefs into the call stack, perhaps
> by using C<caller(n)> as an l-value?
>
>    sub wibble{ caller(0) = sub  { say "This runs after Hello" } }
>
>
>
This syntax is limited to callers only.

From discussion here - it's clear to me that many of you think in the terms
of context oriented programming (without realizing it ...)

Looks like there are two kind of defer usage:
- code layout oriented
- data scope oriented

Although defer may be legit observing code layout.majority of usage may be
related to data frame cleanup (aka: defer (whenever $dbh is defined) { })

Speaking about loop exit operators: how it behaves in with dump ?

This still covers only "programmer-perfect" code, as implemented - doesn't
cover tests, reuse, where whole change one may need
is attach defer to addressable context from outside (see "define meta
operator")

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About