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

Declaring enums with Bools, IntStrs and maybe other things ( enum Foo (:Bar(1), :Baz(True) )) #5194

Open
p6rt opened this issue Mar 24, 2016 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Mar 24, 2016

Migrated from rt.perl.org#127775 (status was 'new')

Searchable as RT127775$

@p6rt
Copy link
Author

p6rt commented Mar 24, 2016

From @AlexDaniel

Code​:
enum Foo <<​:Bar(1) :Baz>>

Result​:
===SORRY!===
Incompatible MROs in P6opaque rebless

<jnthn> That's a crappy error :)

This bug is somewhat similar to https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126987

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

Still present today on rakudo 89470a​:

<Zoffix> m​: enum Foo <<​:Bar(1) :Baz>>
<camelia> rakudo-moar 89470a​: OUTPUT«===SORRY!===␤Incompatible MROs in P6opaque rebless for types Bool and Foo␤»

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @AlexDaniel

Actually, it's not about the error message. The whole thing can be golfed to this​:

enum Foo (​:Bar(1), :Baz(True))

And the error happens because​:

Code​:
use nqp;
say so nqp​::istype(True, Int);
nqp​::rebless(True, Int)

Result​:
True
Incompatible MROs in P6opaque rebless for types Bool and Int
  in block <unit> at -e line 3

Or something like that. So it is “istype” of something but you can't rebless it.

The type is checked here​:
https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621

Rebless is here​:
https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629

IRC logs​:
https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350

I really don't know what to do about it. You cannot just .Int it because stringy enums exist (enum Foo (​:Bar("foo")); say Bar). It's weird.

On 2016-07-10 07​:01​:59, cpan@​zoffix.com wrote​:

Still present today on rakudo 89470a​:

<Zoffix> m​: enum Foo <<​:Bar(1) :Baz>>
<camelia> rakudo-moar 89470a​: OUTPUT«===SORRY!===␤Incompatible MROs in
P6opaque rebless for types Bool and Foo␤»

@p6rt
Copy link
Author

p6rt commented Oct 8, 2017

From @AlexDaniel

Zoffix++ pointed out that there is a problem with IntStr also​:

Code​:
enum Foo (​:Bar(1), :Baz(<42>))

Result​:
===SORRY!===
Incompatible MROs in P6opaque rebless for types IntStr and Foo

On 2017-10-07 17​:16​:30, alex.jakimenko@​gmail.com wrote​:

Actually, it's not about the error message. The whole thing can be
golfed to
this​:

enum Foo (​:Bar(1), :Baz(True))

And the error happens because​:

Code​:
use nqp;
say so nqp​::istype(True, Int);
nqp​::rebless(True, Int)

Result​:
True
Incompatible MROs in P6opaque rebless for types Bool and Int
in block <unit> at -e line 3

Or something like that. So it is “istype” of something but you can't
rebless
it.

The type is checked here​:
https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621

Rebless is here​:
https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629

IRC logs​:
https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350

I really don't know what to do about it. You cannot just .Int it
because
stringy enums exist (enum Foo (​:Bar("foo")); say Bar). It's weird.

On 2016-07-10 07​:01​:59, cpan@​zoffix.com wrote​:

Still present today on rakudo 89470a​:

<Zoffix> m​: enum Foo <<​:Bar(1) :Baz>>
<camelia> rakudo-moar 89470a​: OUTPUT«===SORRY!===␤Incompatible MROs
in
P6opaque rebless for types Bool and Foo␤»

@p6rt
Copy link
Author

p6rt commented Dec 16, 2017

From @AlexDaniel

I am pretty sure that this commit is relevant to this issue​: rakudo/rakudo@fc52143

On 2017-10-07 17​:20​:37, alex.jakimenko@​gmail.com wrote​:

Zoffix++ pointed out that there is a problem with IntStr also​:

Code​:
enum Foo (​:Bar(1), :Baz(<42>))

Result​:
===SORRY!===
Incompatible MROs in P6opaque rebless for types IntStr and Foo

On 2017-10-07 17​:16​:30, alex.jakimenko@​gmail.com wrote​:

Actually, it's not about the error message. The whole thing can be
golfed to
this​:

enum Foo (​:Bar(1), :Baz(True))

And the error happens because​:

Code​:
use nqp;
say so nqp​::istype(True, Int);
nqp​::rebless(True, Int)

Result​:
True
Incompatible MROs in P6opaque rebless for types Bool and Int
in block <unit> at -e line 3

Or something like that. So it is “istype” of something but you can't
rebless
it.

The type is checked here​:

https://github.com/rakudo/rakudo/blob/de0533c4d4c9f425ce22432a8e4555ded27cba91/src/Perl6/Actions.nqp#L4621

Rebless is here​:

https://github.com/rakudo/rakudo/blob/5144216f6ea723747cb25fea51f99861c1ea213a/src/Perl6/World.nqp#L3629

IRC logs​:
https://irclog.perlgeek.de/perl6/2017-10-07#i_15272313
https://irclog.perlgeek.de/perl6/2017-10-08#i_15272350

I really don't know what to do about it. You cannot just .Int it
because
stringy enums exist (enum Foo (​:Bar("foo")); say Bar). It's weird.

On 2016-07-10 07​:01​:59, cpan@​zoffix.com wrote​:

Still present today on rakudo 89470a​:

<Zoffix> m​: enum Foo <<​:Bar(1) :Baz>>
<camelia> rakudo-moar 89470a​: OUTPUT«===SORRY!===␤Incompatible MROs
in
P6opaque rebless for types Bool and Foo␤»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant