Questions tagged [raku]

For questions relating to the Raku programming language (formerly known as Perl 6).

Raku

Raku is an expressive and feature-rich programming language designed by Larry Wall and developed by the community.

Features include:

  • Object-oriented programming
  • Functional programming primitives
  • Parallelism
  • Concurrency
  • Asynchrony
  • Definable grammars for pattern matching and generalized string processing
  • Optional and gradual typing
  • Extensive Unicode support from code points to grapheme clusters
  • Multiple dispatch
  • Introspection
  • Rational numbers

is a Raku implementation that targets multiple back ends.

The MoarVM back end is recommended for normal use, but back ends for the Java Virtual Machine and JavaScript are also under active development.

The Rakudo implementation shipped a first official release named “коледа” on December 25, 2015. Most of the specification is frozen, and optimizations are ongoing.

Official links

1993 questions
6
votes
1 answer

Class method name with ^ doesn't get invoked properly

When I make a class method that starts with a ^, and I try to invoke it, it gives me an error. class C { method ^test () { "Hi" } } dd C.new.test; Too many positionals passed; expected 1 argument but got 2 in method test at .code.tio…
Tyil
  • 1,797
  • 9
  • 14
6
votes
1 answer

When too few threads, program hangs

When the following program is run for -t=17 -fn=15, then the program halts in a reasonable time. This means the maximum number of threads is greater than the number of files that are written and concurrently cached. Update as requested: profiler…
Richard Hainsworth
  • 1,585
  • 7
  • 9
6
votes
1 answer

Creating an executable in Perl6

I am using Moar. It is possible to create perl6 executables now? I have source codes developed on machineA and I want to run it on machineB which is about 3 times faster than machineA, but I don't want people on machineB to be able to look at the…
lisprogtor
  • 5,677
  • 11
  • 17
6
votes
0 answers

"nosink" in AST nodes

This comes from this issue in the Perl 6 documentation, on the differential treatment of colonpairs; while :a is equivalent to a => True, (:a:b) is (a => True b => 1) and :a:b or :a :b simply drops the second; colonpairs behave in a different way…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
6
votes
1 answer

Perl6 Using Proxy to trigger on attribute access

I am trying to implement a trigger on write access to a perl6 Class attribute. I cannot figure out the cause of the error... ... I got this notion from How does one write custom accessor methods in Perl6? 1 #!/usr/bin/env perl6 2 3 class…
librasteve
  • 6,832
  • 8
  • 30
6
votes
1 answer

perl6 spurt vs file handle

It seems that every time I call spurt without :append, it will open and overwrite the file and then close the file automatically. I have been writing thousands of lines to a file in a routine using spurt. Now it seems like a big waste of I/O…
lisprogtor
  • 5,677
  • 11
  • 17
6
votes
1 answer

Perl6 NativeCall cannot locate symbol in native library

I have a module using NativeCall that works on both Linux and macOS, but not Windows. When I try to use the module on Windows I get lots of errors like: # Cannot locate symbol 'TinyTIFFReader_open' in native library 'tinytiff.dll' I use cmake for…
ryn1x
  • 1,052
  • 2
  • 8
  • 19
6
votes
2 answers

Perl6: .sort() doesn't use overridden cmp

According to the documentation, sort compares using infix:. But: class Point { has Int $.x; has Int $.y; method Str { "($!x,$!y)" } method gist { self.Str } } multi sub infix:(Point $a, Point $b) { $a.y cmp $b.y || $a.x cmp…
mscha
  • 6,509
  • 3
  • 24
  • 40
6
votes
2 answers

Updating a program in a CompUnit::PrecompilationStore?

I am working with documents compiled by Rakudo Perl and the documents can get updated. I store the documents in a CompUnit::PrecompilationStore::File How do I change an older version for a newer one? The following program produces the same output,…
Richard Hainsworth
  • 1,585
  • 7
  • 9
6
votes
1 answer

Accessing resources of a dynamically loaded module

I can't find a way to correctly get access to resources of an installed distribution. For example, when a module is loaded dynamically: require ::($module); One way to get hold of its %?RESOURCES is to ask module to have a sub which would return…
Vadim Belman
  • 1,210
  • 6
  • 15
6
votes
1 answer

How to install only test dependencies with Zef

zef has a --deps-only flag for the install subcommand to install only the dependencies of a modules. zef install --deps-only . This installs all the modules referenced in the depends object in META6.json. Is there a similar flag to install all the…
Tyil
  • 1,797
  • 9
  • 14
6
votes
1 answer

Perl 6: maxpairs warns about stringification of undefined values

It looks like maxpairs doesn't like to be called on a list with undefined values: > my @foo; @foo[2] = 4; say @foo.maxpairs; Use of uninitialized value of type Any in string context. Methods .^name, .perl, .gist, or .say can be used to stringify it…
mscha
  • 6,509
  • 3
  • 24
  • 40
6
votes
1 answer

Perl6 NativeCall with Str is encoded('utf16') got randomly corrupted result

I am mapping the GetFullPathName windows API in a perl6 script using NativeCall, for so I wrote the following: #!perl6 use NativeCall; constant \WIN32_MAX_PATH = 260; #I may use directly $path.IO.absolute() sub Win32-GetFullPathName( …
xlat
  • 190
  • 8
6
votes
1 answer

How to disable Perl 6 REPL creating .precomp

Every time I run perl6 to enter the REPL mode, it creates a .precomp directory, which also slows down the appearance of the prompt. If the .precomp directory already exists, the prompt appears almost immediately, otherwise perl6 takes several…
Eugene Barsky
  • 5,780
  • 3
  • 17
  • 40
6
votes
1 answer

Where is "require" defined?

I have been looking in Rakudo source for the implementation of require, first out of curiosity and second because I wanted to know if it was returning something. I looked up sub require and it returned this hit, which actually seems to be the source…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86