develooper Front page | perl.perl5.porters | Postings from July 2020

Re: Types in Cor (and Perl)

Thread Previous | Thread Next
From:
Dave Rolsky
Date:
July 13, 2020 01:52
Subject:
Re: Types in Cor (and Perl)
Message ID:
CAHKw1MJngHp5YYd2thVOLrP1Yu=FO+ZtHrg9QQ1LTXETLZ0gCA@mail.gmail.com
On Sun, Jul 12, 2020 at 8:05 AM Ovid via perl5-porters <
perl5-porters@perl.org> wrote:

> I know very little of Perl's internals or what this would mean. For Cor
> V1, I'd be tempted to go with attributes and Types::Standard (
> :isa(ArrayRef[Int])), but I strongly suspect that it will conflict with
> David's work, and it won't provide the type safety one would expect.
>

Rather than just borging Types::Standard directly I think it's worth
thinking more about what a type system might look like. One huge issue I
have with Types::Standard is that it just copies the mistakes of Moose, so
let's not copy them into the core!

Specifically, I think having a `Str` type that doesn't accept objects which
overload (and similar for other types) is a huge mistake. Of course, once
you start thinking about this you start going down the rabbit hole of
stringification and what it means for something to stringify, since _every_
type in Perl can stringify, but maybe not usefully. Then you start thinking
about things like roles and have a `Stringies` role or something like that.

Is that a road worth going down? I really can't say. But at the very least
it's worth thinking about, and if the core were to explicitly reject that,
it's worth documenting.


Cheers,

Dave Rolsky
http://blog.urth.org
https://github.com/autarch

Thread Previous | Thread Next


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