perigrin / the-room

My Blog

Home Page:http://chris.prather.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[IDEA] Discussion of LeoNerd's vision for Perl 2025 and Types etc.

perigrin opened this issue · comments

Paul Evan's video/talk at FOSDEM in 2021 on what Perl could look like in 5 years time is interesting but basically surrounds two main thoughts: better type inferencing and handling, and destructuring binds.

His whole explicit discussion of Type systems is entirely about type systems as restrictive systems. Ie that type exceptions throw actual exceptions in the language. But really his entire discussion about given/when and switch are about expressive type systems. Swtich is after all a way to dispatch based on the type of the value.

Unlike most languages Perl 5's types are operator defined. Changing this would, even if entirely backwards compatible, be a fundamental change in the language in a way that would IMO necessitate a major version number change.

The proposed equ and === are introducing new operators to expose undef as an explicit Type. The in meta operator shows the problem and a possible solution to this problem (ie we need to add new operators to deal with every native type we want to support) … I don't know how scalable that solution is.

https://ftp.osuosl.org/pub/fosdem/2021/D.perl/perl_in_2025.mp4

Maybe we need to look into a system like Moose's coercion's or Rust's trait derivatives to allow us to explicitly define how to transform our types down to the expectations of native operators.