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

Re: Pre-{Pre-RFC} - match/case syntax

Thread Previous
From:
Nicolas Mendoza
Date:
June 24, 2022 23:03
Subject:
Re: Pre-{Pre-RFC} - match/case syntax
Message ID:
ea8258c6-41c3-2c45-71e2-002c13916d85@pvv.ntnu.no
Den 25.06.2022 00:17, skrev Paul "LeoNerd" Evans:
> I'm nowhere near ready yet to consider writing even a Pre-RFC on
> match/case syntax, because far too much is still open for design. But I
> thought I'd remind people here who enjoy a good language design debate,
> that the thing exists and is being experimented on as a CPAN module:
>
>    https://metacpan.org/pod/Syntax::Keyword::Match
>
> E.g. from the SYNOPSIS:
>
>    use v5.14;
>    use Syntax::Keyword::Match;
>
>    my $n = ...;
>
>    match($n : ==) {
>       case(1) { say "It's one" }
>       case(2) { say "It's two" }
>       case(3) { say "It's three" }
>       case(4), case(5)
>               { say "It's four or five" }
>       default { say "It's something else" }
>    }
>
> There's a lot of design work still to be done on this; several of the
> big questions are sat as "Wishlist" RT tickets on the queue:
>
>    https://rt.cpan.org/Dist/Display.html?Name=Syntax-Keyword-Match
>
>
> I'd encourage anyone who would express an interest in commenting on any
> future (Pre-)RFC on the design of such syntax, should probably begin by
> taking at least a quick look at the module and some of those issues
> now, and ideally help me work them out on CPAN before we even get it
> to the RFC stage.
>
> Ideally we'd proceed with the in-core implementation much like the
> (very successful, if I may say so) try/catch migration which went from
> stable CPAN module to proper in-core implementation very quickly. That
> was possible precisely because it had all that time as a CPAN module to
> work out all the exciting design questions first. It'd be nice to do
> the same process here.
>
By coincidence I watched this earlier today: 
https://www.youtube.com/watch?v=raSRNIoUYig and it felt kind of 
accurate. I also agree that many of the features presented belong 
together. I agree with the whole list/array part is challenging to get 
just right (It made me start thinking of perhaps it is time introducing 
a native list and/or a range object with methods mirroring the operators 
instead).

Thanks for your work and also the great way of slowly (but fast) 
introducing new features to Perl via ::Keyword et al. Fast prototyping 
which people can get a feel with fast seems to be a good approach.




Thread Previous


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