Comments on 2018-09-18 Thoughts on using Perl 6

Sadly, I was unable to produce a small working example. I tried for quite a while. I have no idea what causes this.

I can try something without a small example, as long as you can provide any example that reproduces the issue in at least a semi-reliable fashion. Basically we have a bunch of tools that can run stuff on any given rakudo commit, and bisect if necessary. Just ping me on #perl6 if you have that (a zip file or something like that will do) and I’ll try to find out if it’s a new issue or if it existed before, and we’ll see what caused it if it’s new.

– AlexDaniel 2018-09-18 22:28 UTC

I’ll keep it in mind. It’s been working for today, with no issues except for once. Who knows.

– Alex Schroeder 2018-09-19 14:41 UTC

Here’s another strange thing: locks don’t seem to work as I’d expect them to.

use File::Temp;
my $fh = open('test.p6', :w);
say "File locked: " ~ $fh.lock;
say "Deadlock: " ~ $fh.lock;


File locked: True
Deadlock: True

I sort of expected there to be a deadlock as the second call to lock never returns. But apparently not...

So I wrote my code using empty lock directories, like I did for Perl 5.

– Alex Schroeder 2018-09-19 14:44 UTC

One of the goals of the design of Perl 6 is to be more consistent.

This is why map has a comma after the block, it is just a subroutine and the block is just a lambda.

This consistency is even more evident when you look at the pointy block.

for @a -> $i { say $i }
if $a.method() -> $result { say $result }
my &lambda = -> $a { say $a }

Note that pointy blocks works with all operators of the same form as for and if.

The reason for ?? !! is that

  1. The : is used everywhere for many things, so it is very confusable.
  2. The ? is used for a variety of features itself.
  3. There is no need for !!$a because you can just use ?$a

Frankly, it is a very odd operator because it is in a category all of its own. If it wasn’t already so widespread amongst other languages it probably wouldn’t have been included at all. (similar reason for the inclusion of loop (;;){})

The Regex sub-language got a complete overhaul as it was getting very kludgy. It was also better integrated such that regular Perl 6 language features can be used rather than create regex exclusive features. (A regex in Perl 6 is just a type of method with a different base syntax)

p6doc copies perldoc in that you use the -f flag to read up on functions.

– Brad Gilbert (b2gills) 2018-09-20 23:28 UTC


– Alex Schroeder 2018-09-21 21:31 UTC

Just to note, whenever you would normally reach for a parent class, it’s probably more idiomatic for Perl 6 to use a Role instead.

Then you can have your absolute base class as a role with the barest essentials, including stubbed methods that “role-ing” classes are required to implement.

The advantage is that you don’t end up with the kind of hierarchical entanglement associated with multiple inheritance and you get to keep all the goodness of distinct type-ness, Smartmatching against a role vs a class is the same for the end user, for example.

– ab5tract 2018-09-24 20:01 UTC

Well, right now I’m basically using classes as structs: just data, no methods. Roles seem like a very cool addition to objects, but my love for Lisp leads my code to much less object oriented than what people might be used to.

– Alex Schroeder 2018-09-24 21:48 UTC

Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit this page if you need to fix typos. You can subscribe to updates by email without leaving a comment.

To save this page you must answer this question:

Just say HELLO