Questions tagged [nqp]

Not Quite Perl is a lightweight Perl 6-like environment for virtual machines.

Not Quite Perl is a lightweight Perl 6-like environment for virtual machines.

https://github.com/perl6/nqp

22 questions
10
votes
1 answer

Binding of private attributes: nqp::bindattr vs :=

I'm trying to find how the binding operation works on attributes and what makes it so different from nqp::bindattr. Consider the following example: class Foo { has @!foo; submethod TWEAK { my $fval = []; use…
Vadim Belman
  • 1,210
  • 6
  • 15
10
votes
1 answer

Coercion/type checking: manually reproduce Perl6 standards

I have a Module AttrX::Mooish which implements some of attribute features of Moo/Moose frameworks (lazyness, trigger, etc.). I also wanted the module to be as transparent to the end user as possible meaning support for both private and public…
Vadim Belman
  • 1,210
  • 6
  • 15
9
votes
1 answer

Difference between single pipe and double pipe in Raku Regex (| Vs ||)

There are two types of alternation in Raku's regex: the | and ||. What is the difference ? say 'foobar' ~~ / foo || foobar / # 「foo」 say 'foobar' ~~ / foo | foobar / # 「foobar」
Tinmarino
  • 3,693
  • 24
  • 33
9
votes
1 answer

What is the difference between `nqp::if` and `if` in an .nqp file?

From World.nqp, line 3602 : nqp::if( nqp::istype(nqp::atpos($task,3),$!Block), QAST::Op.new( :op, QAST::WVal.new(:value(nqp::atpos($task,3))), $self, $getattr ), nqp::if( …
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
8
votes
1 answer

What is the "semantic model" introduced in Apocalypse #1?

In Apocalypse #1 Larry wrote, with my added emphasis: Raku will support multiple syntaxes that map onto a single semantic model. Second, that single semantic model will in turn map to multiple platforms. Some vague notions I have of what Larry…
raiph
  • 31,607
  • 3
  • 62
  • 111
8
votes
1 answer

Is there a way to deal with Unix sockets in Perl 6?

I'd like to communicate with mpv using Unix sockets, but Perl 6 doesn't offer any high level interface for doing that. So I thought I could write a little module for that, started digging deeper, found the implementation of IO::Socket::INET, and…
Ramillies
  • 181
  • 2
7
votes
1 answer

How to remove a multi method in Raku

How can I augment a class with a multi-method that will be called before the already defined one ? I am trying to enable negative subscript: @arr[-1] like in this article but without changing the source. So I augment Array with: augment class Array…
Tinmarino
  • 3,693
  • 24
  • 33
7
votes
2 answers

How to print an object, type in nqp

How to print an object in NQP ? (For debugging purposes) It is easy in Raku: say that is calling gist in its short loop code dd The tiny Data Dumper as shown in this post class Toto { has $.member = 42; } class Titi { has $.member = 41; has…
Tinmarino
  • 3,693
  • 24
  • 33
7
votes
2 answers

Errors with role "currying"

In the Perl 6 world, currying is an universal term indicating partial instantiation, and it's also used in the world of (parametrized) roles. However, it's not clear how to actually use it: role Zipi[::T] {}; class Zape does Zipi[::T] {} errors…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
7
votes
1 answer

Obtaining the Pod of a module without explicitly exporting it

The documentation in Perl 6 programs, using the Pod 6 DSL, are actually parsed as part of the code; this makes that documentation available, inside the program, as the $=pod variable. However, I'd like to have access to that variable in order to…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
6
votes
2 answers

Is it possible to run a sub-grammar inside a grammar nqp?

If I have Grammar a and define a Grammar b that have a block '{ ... }' that has syntax of Grammar a, is it possible to somehow link these grammars together? I.e. Grammar a is Tcl and Grammar b is embedded C. How does Rakudo do this when switching…
Konrad Eisele
  • 3,088
  • 20
  • 35
6
votes
1 answer

How to override the NQPMatch.Str function

... Or how to change $.Str value from token sigil { ... } idependently from the matched text. Yes I'm asking how to cheat grammars above (i.e. calling) me. I am trying to write a Slang for Raku without sigil. So I want the nogil token,…
Tinmarino
  • 3,693
  • 24
  • 33
6
votes
1 answer

How to reuse a language token in a custom Grammar (Raku)

I want to reuse the token parameter from Perl6::Grammar in my custom slang to add a "custom-param" parameter without cargo culting. What I mean: my $main-grammar = $*LANG.slang_grammar('MAIN'); my $main-actions = $*LANG.slang_actions('MAIN'); role…
Tinmarino
  • 3,693
  • 24
  • 33
6
votes
1 answer

`Missing or wrong version of dependency` after recompiling nqp

I am trying to learn myself how to debug rakudo and nqp. So this is my first attempt: cd $HOME/debug git clone https://github.com/rakudo/rakudo.git cd rakudo perl Configure.pl --gen-moar --gen-nqp --backends=moar make make install # installs into…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
6
votes
1 answer

Will writing module in NQP (Not Quite Perl) speed up perl6 program?

NQP was mainly designed to bootstrap the perl6 language, but I'm thinking whether it is possible to use it as optimization. I know that rakudo is not perfectly optimized yet, but I'm looking for a long term approach. Perl6 has some low level data…
teodozjan
  • 913
  • 10
  • 35
1
2