Skip to content
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

Subtypes with junctive nominal types give surprising results in Rakudo #1413

Closed
p6rt opened this issue Nov 26, 2009 · 6 comments
Closed

Subtypes with junctive nominal types give surprising results in Rakudo #1413

p6rt opened this issue Nov 26, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Nov 26, 2009

Migrated from rt.perl.org#70844 (status was 'rejected')

Searchable as RT70844$

@p6rt
Copy link
Author

p6rt commented Nov 26, 2009

From @masak

<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.

@p6rt
Copy link
Author

p6rt commented Oct 11, 2011

From @coke

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…

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 11, 2011

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Mon Oct 10 17​:18​:34 2011, coke wrote​:

I think this one has a later duplicate.

@p6rt
Copy link
Author

p6rt commented May 11, 2013

From @coke

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

@p6rt
Copy link
Author

p6rt commented May 11, 2013

@coke - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed May 11, 2013
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant