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

Re: Types in Cor (and Perl)

Thread Previous | Thread Next
From:
=?UTF-8?Q?Branislav_Zahradn=C3=ADk?=
Date:
July 13, 2020 02:08
Subject:
Re: Types in Cor (and Perl)
Message ID:
CAB=rbOmSxRrMgwZfy9Y+ht3R9gLi04F02o9F3y-CiUaxoc6_dQ@mail.gmail.com
On Mon, 13 Jul 2020 at 03:52, Dave Rolsky <autarch@urth.org> wrote:

> 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!
>
>
Great point, question IMHO is do we mean/need/want types or constraints?

Difference:
- constraint is evaluated runtime
- type is declared and trusted

Child type can via inheritance break a constraint imposed by parent type.

Examples with primitive types look nice, but ... who uses primitives and
strong types ?

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