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

Re: PPC Elevator Pitch for Perl::Types

Thread Previous | Thread Next
Chris Prather
September 2, 2023 07:04
Re: PPC Elevator Pitch for Perl::Types
Message ID:

> On Sep 2, 2023, at 12:11 AM, Oodler 577 via perl5-porters <> wrote:
> Our goal is for Perl::Types to be the official data type system of
> Perl, in the same exact way that Corinna is the official class
> system of Perl.

Corinna isn’t a dual-life module, and Paul didn’t even start the conversation about what should go into core until Object::Pad had existed for a year or two (Object::Pad’s first release was October 2019, 5.37.0 was may 2022 … and Corinna was in a later release of the 5.37 series) so the conversation about *how* things could be implemented happened long before anything was brought to p5p. Additionally the features in 5.38 are a *very* stripped down subset of Object::Pad and Corinna, and literally the smallest subset we thought would be useful enough for people to experiment. There are several totally uncontroversial pieces that weren’t added to 5.38 because they weren’t necessary for the smallest possible solution (e.g. Roles).

Note that the PPC process started in the summer of 2021, so the formalities for Corinna weren’t entirely there. It used something more akin to the way Peter Martini got subroutine signatures in, but thankfully with far less drama because there are a lot more stop-gaps and processes to handle the system than there used to be. (The PPC process being a refactoring of these processes, partly I suspect inspired by the ad-hoc conversations that were happening around Corinna)

So if you want to follow this solution, build a working prototype and demonstrate that the ideas even work in principle in an environment that doesn’t depend on RPerl’s C++ compiler. Make some PRs to fix the short comings in the Perl interpreter that make implementing that proof of concept difficult. Then demonstrate how your code would work as a core system. All the while suffering through the sometimes heated arguments about syntax and semantics. 

People have flat out said that your semantics won’t work but I haven’t yet seen a response to that. 

For example what happens with this code:

my $var1         = 234;
my integer $var2 = 456; # Perl::Types
my $total        = $var1 + $var2;

Without the RPerl compiler is this an error? Does $total inherit the integer type? What if I say `$total += 0.1`? What happens if instead of 234 I shift from @ARGV? What if $var1 is a dual var? What if it’s an overloaded object? What if it’s a tie? What if I call bultin::stringify on $var1 (i.e. join “”, $var1;)?

What’s your answer to people who are currently using Type::Tiny? Are they able to upgrade their types to your system? If not is that something you’re planning for?

Corinna had answers to its version of these questions by the time anything ended up on 5.37, and the stuff in 5.37 was the smallest sensible piece of it. I don’t pretend that the Corinna process was flawless, but if you want to follow its path you have about two years of proof of concept to get started on. 

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