Raku Archives

Vikna: pre-release of a text console UI framework for Raku

After almost half a year of work I finally publish my new project Vikna which is also the subject of my talk at the upcoming Conference in the Cloud.

As the subject says, it is a clear pre-release and a proof of concept for the preview of those who might be interested.…

Class, Role And Attribute Accessor in Raku

Quite ingenious title I used here, but it's precise. This story starts with the following case:

role R {
    method a { 666 }
class C does R {
    has $.a = 42;
say C.new.a;

What would you expect this to print?

For those with basic or no knowledge in Raku I'd like to explain that a public attribute gets an automatic accessor method. So, when one does $obj.attribute it's actually a method call.

There could be some disagreement among devs wether the code should output 42 or 666. Though Raku states it explicitly that things defined by class have priority over role's declared ones. Hence, we expect 42 here.

Period, this post is over, everybody is free to go? Alas, this issue says that the code above outputs 666! Oops... What's going on here?

About Vadim Belman

user-pic My interests are in Perl5 and Raku. Pretend to be a Rakudo core developer.