develooper Front page | perl.perl5.porters | Postings from August 2023

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
Paul "LeoNerd" Evans
August 22, 2023 19:03
Re: PPC Elevator Pitch for Perl::Types
Message ID:
On Tue, 22 Aug 2023 18:45:44 +0000
Oodler 577 via perl5-porters <> wrote:

> > I wonder if you are not aware of the keyword plugging system,
> > available since 5.14?
> > It's used extensively by modules like List::Keywords and
> > Object::Pad as ways to prototype new functionality that could
> > eventually be brought into core (and indeed some of it has been,
> > e.g. via Corinna).  
> Thank you, we had not looked at this but will.

It's very powerful; particularly as exposed by XS::Parse::Keyword and
in some cases XS::Parse::Sublike.

With it I've been able to implement:

  * async/await syntax

  * real object syntax

  * real try/catch syntax (that became core's feature 'try')

  * real match/case syntax

All of these things are in use right now today in various real
systems, real companies actually using this lot for real production

They all play together, because they're not silly "lets rewrite the
source code with a regexp" trickery; they're properly integrated into
the parser in a properly reëntrant way. E.g. observe the way you can
put a match/case inside a try/catch block in an `async method` of a
class. Of particular note I want to draw attention to the fact that
combining `async` from Future::AsyncAwait and `method` from Object::Pad
works just fine despite the fact that neither module knows about the
other. When I wrote about programming languages being like Lego sets,
this is precisely the sort of thing I mean.

In addition at Perl v5.38 we added another mechanism for defining new
infix operators; so now while we're getting rid of smartmatch we can
continue to experiment with better replacements for it.

and again - these all play together just fine. You can use an `equ` or
`=:=` operator inside match/case inside try/catch inside ... I think my
point is clear here.

These are the core-supported mechanisms we've been using for the past
decade to experiment with new syntax and new ideas that we eventually
bring into the core language.

Paul "LeoNerd" Evans      |  |

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