New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array[Int] ~~ Array[Numeric] is false #5544
Comments
From @LLFournsay Array[Int] ~~ Array[Int]; # True The last one should be true as well. |
From @zoffixznetOn Sun, 07 Aug 2016 03:51:27 -0700, lloyd.fourn@gmail.com wrote:
How come last one should be same? Aren't they different types? I'd expect `Array[Int] ~~ Positional[Numeric]` to give False Some investigation: ( https://irclog.perlgeek.de/perl6-dev/2017-05-05#i_14534952 ) IIRC calling a method on a role puns it and in fact punned Positional doesn't accept a Positional of a different type, but calling .ACCEPTS does not appear to pun a role: 00:58 Zoffix Calling a method on a role puns it, right? Also, I don't know whether this is right or not; that `istype` op gives true when a role is parameterized with a type that accepts another... |
The RT System itself - Status changed from 'new' to 'open' |
From @smls
They are different types, but one could logically be considered a "subtype" of the other (and would be in some programming languages). E.g. in C#, a class Foo which takes a type parameter can define whether it wants to be, with regard to that parameter (using Perl 6 notation): covariant: Foo[Dog] ~~ Foo[Animal] (Or at least that's how I understand it, I'm just starting to learn C#.) It appears that in Perl 6, currently only *Invariance* is supported for parameterized types. Whether that is a conscious design choice ("keeping it simple"), or something that might be extended in the future given sufficient demand/tuits, is something that jnthn should be able to answer, since if I'm not mistaken he's done much of the Perl 6 OO work and is also a C#/Java expert. |
Migrated from rt.perl.org#128866 (status was 'open')
Searchable as RT128866$
The text was updated successfully, but these errors were encountered: