develooper Front page | perl.perl6.users | Postings from August 2021


Thread Next
Joseph Brenner
August 21, 2021 18:03
Message ID:
Given and example like this:

  class A {}
  class B is A {}
  class D is B {}

  say D.^parents(); # ((B) (A))
  say D.^parents( :all ); # ((B) (A) (Any) (Mu))

So, I conclude that Any and Mu are "hidden" as far as ^parents is concerned.

According to the documentation, ^mro_unhidden does this:

  "Returns a list of types in method resolution order, excluding
  those that are marked with is hidden."

And yet, what I see is:

  say D.^mro_unhidden; # ((D) (B) (A) (Any) (Mu))

So why does this include Any/Mu?

A somewhat related question:  How do you check whether a trait is set
on something?
Can you get a list of all traits?

  raku --version
  Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2020.10.
  Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d.
  Built on MoarVM version 2020.10.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About