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

^mro_unhidden

Thread Next
From:
Joseph Brenner
Date:
August 21, 2021 18:03
Subject:
^mro_unhidden
Message ID:
CAFfgvXWzYaRwj11N-QTQ_kPGq-QPyCUePkiOx7mJB=TTXAg1rQ@mail.gmail.com
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About