🔬7. Digging into operator precedence in Perl 6, part 1

Today, we’ll once again look at the src/core/Bool.pm file. This is a good example of a full-fledged Perl 6 class, which is still not very difficult to examine. Look at the definitions of the ? and so operators: proto sub prefix:<?>(Mu $) is pure {*} multi sub prefix:<?>(Bool:D \a) { a } multi sub prefix:<?>(Bool:U … Continue reading “🔬7. Digging into operator precedence in Perl 6, part 1”

🔬6. The dd routine of Rakudo Perl 6

In Rakudo, there is a useful routine dd, which is not a part of Perl 6 itself. It dumps its argument(s) in a way that you immediately see the type and content of a variable. For example: $ ./perl6 -e’my Bool $b = True; dd($b)’ Bool $b = Bool::True It works well with data of … Continue reading “🔬6. The dd routine of Rakudo Perl 6”

🔬5. Lurking behind interpolation in Perl 6

In the previous articles, we’ve seen that the undefined value cannot be easily interpolated in a string, as an exception occurs. Today, our goal is to see where exactly that happens in the source code of Rakudo. So, as soon as we’ve looked at the Boolean values, let’s continue with them. Open perl6 in the … Continue reading “🔬5. Lurking behind interpolation in Perl 6”

🔬4. Exploring the Bool type in Perl 6, part 2

Today, we are continuing reading the source codes of the Bool class: src/core/Bool.pm, and will look at the methods that calculate the next or the previous values, or increment and decrement the values. For the Boolean type, it sounds simple, but you still have to determine the behaviour of the edge cases. pred and succ … Continue reading “🔬4. Exploring the Bool type in Perl 6, part 2”

🔬3. Playing with the code of Rakudo Perl 6

Yesterday, we looked at the two methods of the Bool class that return strings. The string representation that the functions produce is hardcoded in the source code. Let’s use this observation and try changing the texts. So, here is the fragment that we will modify: Bool.^add_multi_method(‘gist’, my multi method gist(Bool:D:) { self ?? ‘True’ !! … Continue reading “🔬3. Playing with the code of Rakudo Perl 6”