Questions tagged [rakudo]

Rakudo is a compiler for the Raku programming language running on the MoarVM virtual machine.

Rakudo is a Raku compiler running on the MoarVM, JVM and JavaScript.

Related links

189 questions
11
votes
1 answer

Are typed signatures for stubbed methods not enforced in roles for Perl6?

I am trying to do some OOP with Perl6 and am having a little trouble with roles. I am trying to use them in a similar way to a Java interface, where I would just have method signatures that must be implemented by any class that does the role. I am…
ryn1x
  • 1,052
  • 2
  • 8
  • 19
11
votes
3 answers

Is it possible for Perl 6 to work online?

This is probably a naïve and even not a valid question... I've made a Perl 6 program (and hope to make a couple others) which analyzes local data taking into account some user-defined parameters. Several of my colleagues/coworkers need the output of…
Eugene Barsky
  • 5,780
  • 3
  • 17
  • 40
11
votes
1 answer

how do I create a stand-alone executable with perl 6?

The OLD Perl 6 faq said: "Rakudo, a Perl 6 compiler based on Parrot, allows compilation to bytecode, and a small wrapper exists that can pack up a bytecode file and parrot into a single executable." So, it was possible to create a stand-alone…
masukomi
  • 10,313
  • 10
  • 40
  • 49
11
votes
2 answers

How do I read from STDIN in Rakudo Perl6?

As simple as that, how can I read input from STDIN in Perl6? I reckon there's many ways of doing it, but I'm interested in the most idiomatic Perl6 solution.
Cosimo
  • 2,846
  • 1
  • 24
  • 26
10
votes
1 answer

Multi-dispatch to candidate with native parameters not working

I am trying to use multi in my Raku code that wraps a function in C. Here I am calling lchoose function in shared libray Rmath. This is my code which works: use NativeCall; constant RMATH = "./Rmath"; # shared library sub lchoose(num64, num64)…
Suman Khanal
  • 3,079
  • 1
  • 17
  • 29
10
votes
1 answer

Assignment destructuring and operator precedence

The documentation says that the comma operator has higher precedence than the assignment = operator, and this is specifically different than in Perl, so that we are allowed to remove parentheses in some contexts. This allows us to do things like…
WhiteMist
  • 885
  • 4
  • 13
10
votes
1 answer

Why can't a sub access dynamic variables when used in a "return"ed map in raku?

It seems that a a sub cannot access dynamic variables when it is used inside a map and that map is "return"ed. Consider this piece of code: sub start { my $*something = 'foobar'; # WORKS say 'first say-something:'; …
Julio
  • 5,208
  • 1
  • 13
  • 42
10
votes
1 answer

Symbols that break the identifier rules, e.g. `sub ::("☺") { }`

With the current Rakudo compiler (v2021.10), symbols declared with the ::(…) form do not need to follow the rules for identifiers even when they declare the name of a routine. This means that the following is code produces the indicated…
codesections
  • 8,900
  • 16
  • 50
10
votes
1 answer

Checking if a react block is ready for business

When writing concurrent code, it's fairly common to want to spin off a separate (green or OS) thread and then ask the code in that thread to react to various thread-safe messages. Raku supports this pattern in a number of ways. For example, many of…
codesections
  • 8,900
  • 16
  • 50
10
votes
1 answer

Destructuring/list assignment with the `has` declarator

[I ran into the issues that prompted this question and my previous question at the same time, but decided the two questions deserve to be separate.] The docs describe using destructuring assignment with my and our variables, but don't mention…
codesections
  • 8,900
  • 16
  • 50
10
votes
2 answers

What is the _intended_ value of &?ROUTINE?

The Rakudo implementation of Raku tracks multiple issues about the (very useful!) &?ROUTINE variable not providing the correct value (e.g., #1768 and 2362), so I realize that it's not behaving quite correctly. But I'm trying to understand what it's…
codesections
  • 8,900
  • 16
  • 50
10
votes
1 answer

CONTROL phasers from a trait

Is it possible to add a CONTROL phaser from a trait? Following the example from the docs, it's simple to add a custom control exception in runtime code: class CX::Oops does X::Control {}; sub f { CONTROL { when CX::Oops { note 'Oops!'; .resume}} …
codesections
  • 8,900
  • 16
  • 50
10
votes
3 answers

Enforcing API boundaries at the Module (Distribution?) level

How do I structure Raku code so that certain symbols are public within the the library I am writing, but not public to users of the library? (I'm saying "library" to avoid the terms "distribution" and "module", which the docs sometimes use in…
codesections
  • 8,900
  • 16
  • 50
10
votes
2 answers

Raku regex: How to know which group was captured at an alternation

With perl (and almost any regex flavour), every group is numbered sequentially. So for example, this code: 'bar' =~ m/(foo)|(bar)/; print $1 // 'x'; # (1-based index) print $2 // 'x'; # (1-based index) prints xbar However, with Raku it behaves…
Julio
  • 5,208
  • 1
  • 13
  • 42
10
votes
1 answer

How does lazyness of the slice index affects the slicing of an array/list? [RAKU]

When we slice an array with an index that exceeds the boundaries of the array we get as the result the undefined (Any) When we pass the same slice index as a lazy list then we get as result the existing values of the array/list (and NOT any more…
jakar
  • 1,701
  • 5
  • 14
1 2
3
12 13