in reply to updating Devel::BeginLift (or, statement vs. expression keywords)

> Are there other modules that can define keywords with this flexibility?

Not that I'm aware of. The limitation of Keyword::Simple to statements is a major headache to many projects.

> I also tried starting from scratch with Keyword::Simple,

This would have been my suggestion, but you'll need to patch all code with a curry expression with a surrounding do {...}

I only had a brief look into Sub::Curried but it seems to me that the "composition" features won't make it easier.

Personally I think it would have been better to design all this with syntax of function attributes like :curry

But going this way won't save you from refactoring your code.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: updating Devel::BeginLift (or, statement vs. expression keywords)
by prj (Initiate) on Jun 14, 2024 at 07:55 UTC

    Thanks--yeah, if I were starting from scratch I'd probably do something like Attribute::Curried for the sake of a less fragile implementation. I do like Sub::Curried's composition operators, though, so I'd keep those. (Some of them are actually my own contribution.)

    I might end up taking a stab at a more flexible keyword module myself. Got any pointers, besides perlapi and the source of the existing modules?

      Definitely make contact with Paul Evans (PEVANS, leonerd): he wrote most of the keyword infrastructure, and as far as I understand it would like to bring it into perl core if/when he can get it to the right combination of stability and flexibility.

      > Got any pointers, besides perlapi and the source of the existing modules?

      No sorry. *

      Combining attribute handlers and (moderate) source filters are my best bet in your case¹.

      They are old and stable.

      I'm not a big fan on building skyscrapers of code on more and more experimental modules to invent fancy syntax.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

      *) I don't claim to know all internal hooks and possibilities!

      ¹) rescuing "a lot of code" with nonstandard syntax.