On Mon Oct 10 17:18:34 2011, coke wrote:
> On Thu Nov 26 08:10:19 2009, masak wrote:
> > <masak> rakudo: class A {}; class B {}; subset C of A & B; say C ~~
> A;
> > say C ~~ B
> > <p6eval> rakudo 7347ec:  ( no output )
> > <masak> locally, that gives 1\n0\n
> > <moritz_> std: class A {}; class B {}; subset C of A & B; say C ~~
> A;
> > say C ~~ B
> > <p6eval> std 29199: ok 00:01 106m␤
> > <moritz_> masak: everything that declares a new class makes p6eval
> > time out
> > * masak submits rakudobug
> > <masak> ah! the 'subset' syntax only expects exactly one type.
> > <masak> that explains the strange output from the first one-liner.
> > <masak> rakudo: subset C of (Str & Int); say C ~~ Str; say C ~~ Int
> > <p6eval> rakudo 7347ec: Confused at line 2, near "of (Str & " [...]
> > <moritz_> masak: subsets are basically a nominal type + constraints,
> I
> > don't think you can make a symmetric, conjunctive type of two other
> > types
> > <masak> moritz_: no, probably not.
> > <masak> moritz_: wait. it depends. for roles, it shouldn't be a
> > problem.
> > <masak> actually, now I don't see the problem at all.
> > <masak> the nominal part happens to be an and-junction.
> 
> Current behavior:
> 
> 20:17 < [Coke]> rakudo: class A {}; class B {}; subset C of A & B; say
> C ~~
>                 A;say C ~~ B
> 20:17 <+p6eval> rakudo 38907e: OUTPUT«Type check failed in assignment
> to '$v';
>                 expected 'Mu' but got 'C'␤  in method REIFY at
>                 src/gen/CORE.setting:4391␤  in method reify at
>                 src/gen/CORE.setting:3657␤  in method reify at
>                 src/gen/CORE.setting:3657␤  in method gimme at
>                 src/gen/CORE.setting:4015␤  in metho…

02:40 < [Coke]> rakudo: class A {}; class B {}; subset C of A & B; say C ~~ A;
                say C ~~ B # RT#70844
02:40 <+camelia> rakudo bfd850: OUTPUT«True␤False␤»
02:41 < TimToady> I'm pretty sure that's parsing as (subset C of A) & B
02:42  * TimToady is a little surprised it's not giving a "Useless use of & in
          sink context"
02:44 < [Coke]> rakudo: class A {}; class B {}; subset C of (A & B); say C ~~
                A; say C ~~ B # RT#70844
02:44 <+camelia> rakudo bfd850: OUTPUT«===SORRY!===␤Confused␤at
                 /tmp/XuBccnEAYS:1␤------> class A {}; class B {}; subset C of
                 ⏏(A & B); say C ~~ A; say C ~~ B # RT#708␤    expecting any
                 of:␤        statement list␤        horizontal whitespace␤
                 postfix␤        …
02:45 < TimToady> [Coke]: note that the 'of' trait only allows a single name
02:46 < TimToady> you'd have to write: subset C of Any where A & B
02:47 < [Coke]> rakudo: class A {}; class B {}; subset C of Any where A & B;
                say C ~~ A; say C ~~ B # RT#70844
02:47 <+camelia> rakudo bfd850: OUTPUT«False␤False␤»
02:47 < TimToady> subset isn't about inheritance, except kinda by accident
02:48 < TimToady> if you want multiple inheritance, subset isn't the way to get
                  it
02:50 < [Coke]> rakudo: class A {}; class B {}; subset C of A|B; say C ~~ A;
                say C ~~ B # RT#70844
02:50 <+camelia> rakudo bfd850: OUTPUT«True␤False␤»
02:50 < TimToady> "useless use of | in sink context"
02:54 < TimToady> we haven't had junctional types in Perl 6 for most of the
                  last 10 years
02:54 < [Coke]> ticket's from 2009
02:54 < TimToady> so someone was remembering the old days
02:55 < TimToady> junctional types were deemed to be impossible to understand,
                  and a general public nuisance
02:55 < TimToady> on top of which, we stole the syntax
02:56 < TimToady> since signatures can contain | or & that don't mean junctions
                  now
02:57 < TimToady> so I can pretty safely say that you'll never just be able to
                  throw A&B or A|B in where were currently parse a single type
02:59 < TimToady> I'd just close that one as Not a Bug

Rejecting as not a bug.

-- 
Will "Coke" Coleda

Reply via email to