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
12
votes
1 answer

Why does the Perl 6 sequence 'A' ... 'AA' have only one element?

Today I noticed that the sequence 'A' ... 'AA' contains only one element: > 'A' ... 'AA' (A) I thought it would contain 27: the alphabet plus the final AA. If I explicitly provide a generator, it does: > 'A', *.succ ... 'AA' (A B C D E F G H I J K…
Sean
  • 29,130
  • 4
  • 80
  • 105
12
votes
1 answer

Perl6 sub MAIN/ command line Parsing

In Perl 5, I was able to set an option multiple times like in this question: Perl Getopt Using Same Option Multiple Times I am wondering if it's possible to do the same with Perl 6 and the MAIN sub ?
Sebus
  • 430
  • 2
  • 10
12
votes
0 answers

Setting TCP flags with IO::Socket::Async

I'm writing a Telnet library, and one of the commands requires setting the URGENT flag on the TCP packet sent according to RFC854: The Synch is sent via the TCP send operation with the Urgent flag set and the DM as the last (or only) data…
Kaiepi
  • 3,230
  • 7
  • 27
12
votes
3 answers

Is it possible to embed perl6 in a C (or C++) program?

In perl5 it was easy to link in libperl.so, set some variables and run some code, with callbacks. Is there a story for doing this in perl6?
Andrew
  • 166
  • 4
12
votes
4 answers

How can I discover all the roles a Perl 6 type does?

With .does I can check if a type has the role I already know. I'd like to get the list of roles. Inheritance has .^mro but I didn't see anything like that for roles in the meta model stuff. Along with that, given a "type", how can I tell if it was…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
12
votes
1 answer

Perl 6 Cro's stub doesn't run: HTTP/2 is requested, but ALPN is not supported

I created a stub service with Perl 6's cro but it errors out because "ALPN is not supported". $ cro stub http ds4 ds4 Stubbing a HTTP Service 'ds4' in 'ds4'... First, please provide a little more information. Secure (HTTPS) (yes/no) [no]:…
user2410502
12
votes
0 answers

Is there any way to list the functions and data structures available from the native interface in Raku?

Mainly with the objective of creating sensible examples, I'd like to know which data structures and functions are available for use in Raku's native interface, as in class a-class is repr('CStruct') { has int $.whatever; } class another-class is…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
12
votes
2 answers

Using public and private methods inside their class

If I have a public method, I can call it inside its class using both $.name and self.name: class TEST { has Int $.a; method b($x) { return $!a * $x; } method c($y) { return self.b($y) * 3; # or $.b($y) } } my $m = TEST.new(a =>…
Eugene Barsky
  • 5,780
  • 3
  • 17
  • 40
12
votes
2 answers

Difference between print, put and say?

In Perl 6, what is the difference between print, put and say? I can see how print 5 is different, but put 5 and say 5 look the same.
Stefanus
  • 1,619
  • 3
  • 12
  • 23
12
votes
1 answer

How to handle varargs with NativeCall

I'm writing bindings for Editline; one of its functions, history, does the bulk of the work for this part of the library, but has several possible signatures: :(Pointer[Internal], Pointer[Event], int32 --> int32) :(Pointer[Internal], Pointer[Event],…
Kaiepi
  • 3,230
  • 7
  • 27
12
votes
4 answers

Why does constraining a Perl 6 named parameter to a definite value make it a required value?

Consider these subroutines that all take a single named parameter. Named parameters should be optional and I haven't seen anything to say there are exceptions to that. With no type constraints there's no problem; the named parameter is not required.…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
12
votes
3 answers

Executing Perl 6 code in Rmarkdown

I want to write some tutorials on Perl 6. For this I believe Rmarkdown would be of great help. So I am trying to execute Perl 6 code within Rmarkdown document. My Perl 6 executable is in C:\rakudo\bin. So my .Rmd file with example code to…
Suman Khanal
  • 3,079
  • 1
  • 17
  • 29
12
votes
2 answers

How does a Perl 6 object find a multi method that might be in a parent class or role?

Consider this example where a subclass has a multi method with no signature and one with a slurpy parameter: class Foo { multi method do-it { put "Default" } multi method do-it ( Int $n ) { put "Int method" } multi method do-it ( Str $s…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
12
votes
1 answer

How do I find the version and authority of a Perl 6 module?

In Bar.pm, I declare a class with an authority (author) and a version: class Bar:auth:ver<4.8.12> { } If I use it in a program, how do I see which version of a module I'm using, who wrote it, and how the module loader found it? As…
brian d foy
  • 129,424
  • 31
  • 207
  • 592
12
votes
2 answers

Meaning of `@$array` and other constructs

I am still learning Perl 6. Please pardon my ignorance. I am reading the Operators page and I found some unfamiliar constructs at the start of a table: A Level Examples N Terms 42 3.14 "eek" qq["foo"] $x :!verbose @$array I re-read class…
lisprogtor
  • 5,677
  • 11
  • 17